summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorWenwen Wang <wenwen@cs.uga.edu>2019-08-19 02:18:34 +0200
committerMike Snitzer <snitzer@redhat.com>2019-08-21 17:47:05 +0200
commitdc1a3e8e0cc6b2293b48c044710e63395aeb4fb4 (patch)
tree1b1bcd524944340fb94f35354956f0334dd38a6d /drivers/md
parentdm zoned: fix potential NULL dereference in dmz_do_reclaim() (diff)
downloadlinux-dc1a3e8e0cc6b2293b48c044710e63395aeb4fb4.tar.xz
linux-dc1a3e8e0cc6b2293b48c044710e63395aeb4fb4.zip
dm raid: add missing cleanup in raid_ctr()
If rs_prepare_reshape() fails, no cleanup is executed, leading to leak of the raid_set structure allocated at the beginning of raid_ctr(). To fix this issue, go to the label 'bad' if the error occurs. Fixes: 11e4723206683 ("dm raid: stop keeping raid set frozen altogether") Cc: stable@vger.kernel.org Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-raid.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 8a60a4a070ac..1f933dd197cd 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3194,7 +3194,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
*/
r = rs_prepare_reshape(rs);
if (r)
- return r;
+ goto bad;
/* Reshaping ain't recovery, so disable recovery */
rs_setup_recovery(rs, MaxSector);