The patch titled Subject: loopdev: remove an user triggerable oops has been added to the -mm tree. Its filename is loopdev-remove-an-user-triggerable-oops.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Guo Chao <yan@xxxxxxxxxxxxxxxxxx> Subject: loopdev: remove an user triggerable oops When loopdev is built as module and we pass an invalid parameter, loop_init() will return directly without deregister misc device, which will cause an oops when insert loop module next time because we left some garbage in the misc device list. Test case: sudo modprobe loop max_part=1024 (failed due to invalid parameter) sudo modprobe loop (oops) Clean up nicely to avoid such oops. Signed-off-by: Guo Chao <yan@xxxxxxxxxxxxxxxxxx> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Guo Chao <yan@xxxxxxxxxxxxxxxxxx> Cc: M. Hindess <hindessm@xxxxxxxxxx> Cc: Nikanth Karthikesan <knikanth@xxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/block/loop.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff -puN drivers/block/loop.c~loopdev-remove-an-user-triggerable-oops drivers/block/loop.c --- a/drivers/block/loop.c~loopdev-remove-an-user-triggerable-oops +++ a/drivers/block/loop.c @@ -1844,11 +1844,15 @@ static int __init loop_init(void) max_part = (1UL << part_shift) - 1; } - if ((1UL << part_shift) > DISK_MAX_PARTS) - return -EINVAL; + if ((1UL << part_shift) > DISK_MAX_PARTS) { + err = -EINVAL; + goto misc_out; + } - if (max_loop > 1UL << (MINORBITS - part_shift)) - return -EINVAL; + if (max_loop > 1UL << (MINORBITS - part_shift)) { + err = -EINVAL; + goto misc_out; + } /* * If max_loop is specified, create that many devices upfront. @@ -1866,8 +1870,10 @@ static int __init loop_init(void) range = 1UL << MINORBITS; } - if (register_blkdev(LOOP_MAJOR, "loop")) - return -EIO; + if (register_blkdev(LOOP_MAJOR, "loop")) { + err = -EIO; + goto misc_out; + } blk_register_region(MKDEV(LOOP_MAJOR, 0), range, THIS_MODULE, loop_probe, NULL, NULL); @@ -1880,6 +1886,10 @@ static int __init loop_init(void) printk(KERN_INFO "loop: module loaded\n"); return 0; + +misc_out: + misc_deregister(&loop_misc); + return err; } static int loop_exit_cb(int id, void *ptr, void *data) _ Patches currently in -mm which might be from yan@xxxxxxxxxxxxxxxxxx are linux-next.patch block-use-i_size_write-in-bd_set_size.patch block-remove-redundant-check-to-bd_openers.patch loopdev-fix-a-deadlock.patch loopdev-update-block-device-size-in-loop_set_status.patch loopdev-move-common-code-into-loop_figure_size.patch loopdev-remove-an-user-triggerable-oops.patch loopdev-ignore-negative-offset-when-calculate-loop-device-size.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html