Messages in this thread Patch in this message | | | Date | Tue, 22 Jul 2008 16:14:34 -0700 | From | Greg KH <> | Subject | [patch 06/47] md: Fix error paths if md_probe fails. |
| |
2.6.25-stable review patch. If anyone has any objections, please let us know.
------------------ From: Neil Brown <neilb@notabene.brown>
commit 9bbbca3a0ee09293108b67835c6bdf6196d7bcb3 upstream
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: Dave Jones <davej@redhat.com> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--- drivers/md/md.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -3804,8 +3804,10 @@ static void autorun_devices(int part) md_probe(dev, NULL, NULL); mddev = mddev_find(dev); - if (!mddev) { - printk(KERN_ERR + if (!mddev || !mddev->gendisk) { + if (mddev) + mddev_put(mddev); + printk(KERN_ERR "md: cannot allocate memory for md drive.\n"); break; } --
| |