Bug in ll_rw_blk.c in 2.3.10/11

Jan Kara (jack@atrey.karlin.mff.cuni.cz)
Tue, 27 Jul 1999 23:44:08 +0200


--jUlQ0s9EVzWg2teH
Content-Type: text/plain; charset=us-ascii

Hello.

I think I've found a bug in make_request() in ll_rw_blk.c in 2.3.10 or 11. The
problem is that when access beyond the end of device is done, all flags except BH_Locked
are cleared. This also means clearing of flag BH_Mapped so when you try to read the block
second time, ll_rw_block() complains about not mapped buffer and does BUG()...
My fix simply preserves the BH_mapped flag too but I'm not sure this is the right fix.
If it is, the patch is attached.

Honza.

--jUlQ0s9EVzWg2teH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ll_rw_blk.c.diff"

--- linux/drivers/block/ll_rw_blk.c Tue Jul 27 23:25:20 1999
+++ linux/drivers/block/ll_rw_blk.c Tue Jul 27 23:24:51 1999
@@ -403,7 +403,7 @@
unsigned long maxsector = (blk_size[major][MINOR(bh->b_rdev)] << 1) + 1;

if (maxsector < count || maxsector - count < sector) {
- bh->b_state &= (1 << BH_Lock);
+ bh->b_state &= (1 << BH_Lock) | (1 << BH_Mapped);
/* This may well happen - the kernel calls bread()
without checking the size of the device, e.g.,
when mounting a device. */

--jUlQ0s9EVzWg2teH--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/