[PATCH] raw driver oops fix
From: Dave Olien <dmo@osdl.org> The raw.c character device Oopses dereferencing a NULL pointer in bd_claim() This problem occurred after bd_claim() in block_dev.c was modified to "claim the whole device when a partition is claimed". raw_open() made the mistake of calling bd_claim BEFORE calling blkdev_get(). At that time, the bdev->bd_contains field has not yet been initialized. Switching the order allows blkdev_get() to initialize those fields before calling bd_claim(). Also fixed up some error return paths: igrab() should never fail under these circumstances since the caller already has a reference to that inode through the bdev at that time. In the event of blkdev_get() failure or set_blocksize() failure, not all the work to unwind from the error was done.
Showing
Please register or sign in to comment