diff options
author | NeilBrown <neilb@suse.de> | 2007-02-28 23:11:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-01 17:53:36 -0500 |
commit | 5a243e0e97edce27c12f87354fd987526ba1ce95 (patch) | |
tree | 25911ba3555cefaab804a607988763fe28f6770c /drivers/block/umem.c | |
parent | 9540f75b2bcfcc29ddcd839c3547a5f380bef323 (diff) |
[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.c | 5 |
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) | |||
1179 | return -ENOMEM; | 1179 | return -ENOMEM; |
1180 | 1180 | ||
1181 | err = major_nr = register_blkdev(0, "umem"); | 1181 | err = major_nr = register_blkdev(0, "umem"); |
1182 | if (err < 0) | 1182 | if (err < 0) { |
1183 | pci_unregister_driver(&mm_pci_driver); | ||
1183 | return -EIO; | 1184 | return -EIO; |
1185 | } | ||
1184 | 1186 | ||
1185 | for (i = 0; i < num_cards; i++) { | 1187 | for (i = 0; i < num_cards; i++) { |
1186 | mm_gendisk[i] = alloc_disk(1 << MM_SHIFT); | 1188 | mm_gendisk[i] = alloc_disk(1 << MM_SHIFT); |
@@ -1207,6 +1209,7 @@ static int __init mm_init(void) | |||
1207 | return 0; | 1209 | return 0; |
1208 | 1210 | ||
1209 | out: | 1211 | out: |
1212 | pci_unregister_driver(&mm_pci_driver); | ||
1210 | unregister_blkdev(major_nr, "umem"); | 1213 | unregister_blkdev(major_nr, "umem"); |
1211 | while (i--) | 1214 | while (i--) |
1212 | put_disk(mm_gendisk[i]); | 1215 | put_disk(mm_gendisk[i]); |