diff options
author | NeilBrown <neilb@suse.de> | 2015-03-13 01:51:18 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2015-03-20 23:40:36 +0100 |
commit | 0c35bd4723e4a39ba2da4c13a22cb97986ee10c8 (patch) | |
tree | cb02268569a79cd8b7e898def4e86ba2707ed753 /drivers/md/md.c | |
parent | Linux 4.0-rc4 (diff) | |
download | linux-0c35bd4723e4a39ba2da4c13a22cb97986ee10c8.tar.xz linux-0c35bd4723e4a39ba2da4c13a22cb97986ee10c8.zip |
md: fix problems with freeing private data after ->run failure.
If ->run() fails, it can either free the data structures it
allocated, or leave that task to ->free() which will be called
on failures.
However:
md.c calls ->free() even if ->private_data is NULL, which
causes problems in some personalities.
raid0.c frees the data, but doesn't clear ->private_data,
which will become a problem when we fix md.c
So better fix both these issues at once.
Reported-by: Richard W.M. Jones <rjones@redhat.com>
Fixes: 5aa61f427e4979be733e4847b9199ff9cc48a47e
URL: https://bugzilla.kernel.org/show_bug.cgi?id=94381
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index cadf9cc02b25..717daad71fb1 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5080,7 +5080,8 @@ int md_run(struct mddev *mddev) } if (err) { mddev_detach(mddev); - pers->free(mddev, mddev->private); + if (mddev->private) + pers->free(mddev, mddev->private); module_put(pers->owner); bitmap_destroy(mddev); return err; |