]> git.baikalelectronics.ru Git - kernel.git/commit
dm zoned: free dmz->ddev array in dmz_put_zoned_devices
authorFedor Pchelkin <pchelkin@ispras.ru>
Wed, 20 Sep 2023 10:51:16 +0000 (13:51 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Oct 2023 20:00:44 +0000 (22:00 +0200)
commitf60287b2d2409b1d2c45f144191ab6ee9bd77421
tree040400dab1d8a8a5cbed0107ab2dc889b7162bd9
parent485f0bac83a61878ab1214dc1957dc66956e1e88
dm zoned: free dmz->ddev array in dmz_put_zoned_devices

commit 9850ccd5dd88075b2b7fd28d96299d5535f58cc5 upstream.

Commit 4dba12881f88 ("dm zoned: support arbitrary number of devices")
made the pointers to additional zoned devices to be stored in a
dynamically allocated dmz->ddev array. However, this array is not freed.

Rename dmz_put_zoned_device to dmz_put_zoned_devices and fix it to
free the dmz->ddev array when cleaning up zoned device information.
Remove NULL assignment for all dmz->ddev elements and just free the
dmz->ddev array instead.

Found by Linux Verification Center (linuxtesting.org).

Fixes: 4dba12881f88 ("dm zoned: support arbitrary number of devices")
Cc: stable@vger.kernel.org
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-zoned-target.c