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]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux