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

Commit 9bbbca3a authored by Neil Brown's avatar Neil Brown
Browse files

Fix error paths if md_probe fails.



md_probe can fail (e.g. alloc_disk could fail) without
returning an error (as it alway returns NULL).
So when we call mddev_find immediately afterwards, we need
to check that md_probe actually succeeded.  This means checking
that mdev->gendisk is non-NULL.

cc: <stable@kernel.org>
Cc: Dave Jones <davej@redhat.com>
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
parent efe31143
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -3897,7 +3897,9 @@ static void autorun_devices(int part)

		md_probe(dev, NULL, NULL);
		mddev = mddev_find(dev);
		if (!mddev) {
		if (!mddev || !mddev->gendisk) {
			if (mddev)
				mddev_put(mddev);
			printk(KERN_ERR
				"md: cannot allocate memory for md drive.\n");
			break;