Re: [PATCH 08/10] md: stop using for_each_mddev in md_exit

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

 



On 7/19/22 09:03, Christoph Hellwig wrote:
On Mon, Jul 18, 2022 at 09:10:59AM +0200, Hannes Reinecke wrote:

Having thought about it some more ... wouldn't it make sense to modify
mddev_get() to

if (atomic_inc_not_zero(&mddev->active))
     return NULL;

to ensure we're not missing any use-after-free issues, which previously
would have been caught by the 'for_each_mddev()' macro?

No.  mddev->active = 0 can still be a perfectly valid mddev and they
are not automatically deleted.  Check the conditions in mddev_put.

Sigh. Okay.
MD is a mess anyway.

Reviewed-by: Hannes Reinecke <hare@xxxxxxx>

Cheers,

Hannes



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux