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