Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c35bd47 authored by NeilBrown's avatar NeilBrown
Browse files

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: default avatarRichard W.M. Jones <rjones@redhat.com>
Fixes: 5aa61f42
URL: https://bugzilla.kernel.org/show_bug.cgi?id=94381


Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 06e5801b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -5080,6 +5080,7 @@ int md_run(struct mddev *mddev)
	}
	if (err) {
		mddev_detach(mddev);
		if (mddev->private)
			pers->free(mddev, mddev->private);
		module_put(pers->owner);
		bitmap_destroy(mddev);
+0 −2
Original line number Diff line number Diff line
@@ -467,8 +467,6 @@ static int raid0_run(struct mddev *mddev)
	dump_zones(mddev);

	ret = md_integrity_register(mddev);
	if (ret)
		raid0_free(mddev, conf);

	return ret;
}