RE: [PATCH v3] ceph: fix slab-use-after-free in have_mon_and_osd_map()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2025-03-04 at 08:56 +0000, David Howells wrote:
> Viacheslav Dubeyko <slava@xxxxxxxxxxx> wrote:
> 
> > +	mutex_lock(&monc->mutex);
> >  	kfree(monc->monmap);
> > +	monc->monmap = NULL;
> > +	mutex_unlock(&monc->mutex);
> 
> I would do the kfree after the locked region:
> 
> 	mutex_lock(&monc->mutex);
> 	old_monmap = monc->monmap;
> 	monc->monmap = NULL;
> 	mutex_unlock(&monc->mutex);
> 	kfree(old_monmap);
> 

Makes sense to me. I like this way. Let me rework the patch.

Thanks,
Slava.






[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux