Skip to content

Commit

Permalink
floppy: fix another use-after-free
Browse files Browse the repository at this point in the history
While scanning the floopy code due to c093ee4 ("floppy: fix
use-after-free in module load failure path"), I found one more instance
of trying to access disk->queue pointer after doing put_disk() on
gendisk.  For some reason , floppy moule still loads/unloads fine.  The
object is probably still around with right pointer values.

 o There seems to be one more instance of trying to cleanup the request
   queue after we have called put_disk() on associated gendisk.

 o This fix is more out of code inspection.  Even without this fix for
   some reason I am able to load/unload floppy module without any
   issues.

 o Floppy module loads/unloads fine after the fix.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
rhvgoyal authored and torvalds committed Nov 6, 2010
1 parent 151f52f commit d017bf6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -4573,8 +4573,8 @@ static void __exit floppy_module_exit(void)
device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
platform_device_unregister(&floppy_device[drive]);
}
put_disk(disks[drive]);
blk_cleanup_queue(disks[drive]->queue);
put_disk(disks[drive]);
}

del_timer_sync(&fd_timeout);
Expand Down

0 comments on commit d017bf6

Please sign in to comment.