Skip to content

Commit

Permalink
dm raid: add missing cleanup in raid_ctr()
Browse files Browse the repository at this point in the history
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: 11e4723 ("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>
  • Loading branch information
Wenwen Wang authored and Mike Snitzer committed Aug 21, 2019
1 parent e0702d9 commit dc1a3e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/dm-raid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dc1a3e8

Please sign in to comment.