summaryrefslogtreecommitdiffstats
path: root/drivers/block/umem.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-03-01 05:11:12 +0100
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-01 23:53:36 +0100
commit5a243e0e97edce27c12f87354fd987526ba1ce95 (patch)
tree25911ba3555cefaab804a607988763fe28f6770c /drivers/block/umem.c
parent[PATCH] drivers/video/sm501fb.c: make 4 functions static (diff)
downloadlinux-5a243e0e97edce27c12f87354fd987526ba1ce95.tar.xz
linux-5a243e0e97edce27c12f87354fd987526ba1ce95.zip
[PATCH] Fix failure paths in modules init in umem.c
If register_blkdev() or alloc-disk fail in mm_init() after pci_register_driver() succeeds, then mm_pci_driver is not unregistered properly: Cc: Philip Guo <pg@cs.stanford.edu> Signed-off-by: Neil Brown <neilb@suse.de> Cc: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/umem.c')
-rw-r--r--drivers/block/umem.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index dff3766f117f..5872036e8ae6 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -1179,8 +1179,10 @@ static int __init mm_init(void)
return -ENOMEM;
err = major_nr = register_blkdev(0, "umem");
- if (err < 0)
+ if (err < 0) {
+ pci_unregister_driver(&mm_pci_driver);
return -EIO;
+ }
for (i = 0; i < num_cards; i++) {
mm_gendisk[i] = alloc_disk(1 << MM_SHIFT);
@@ -1207,6 +1209,7 @@ static int __init mm_init(void)
return 0;
out:
+ pci_unregister_driver(&mm_pci_driver);
unregister_blkdev(major_nr, "umem");
while (i--)
put_disk(mm_gendisk[i]);