]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
direct-io: fix error-path crashes
authorBadari Pulavarty <pbadari@us.ibm.com>
Fri, 10 Aug 2007 20:00:44 +0000 (13:00 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sat, 11 Aug 2007 22:47:40 +0000 (15:47 -0700)
Need to initialize map_bh.b_state to zero.  Otherwise, in case of a faulty
user-buffer its possible to go into dio_zero_block() and submit a page by
mistake - since it checks for buffer_new().

http://marc.info/?l=linux-kernel&m=118551339032528&w=2

akpm: Linus had a (better) patch to just do a kzalloc() in there, but it got
lost.  Probably this version is better for -stable anwyay.

Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
Acked-by: Joe Jin <joe.jin@oracle.com>
Acked-by: Zach Brown <zach.brown@oracle.com>
Cc: gurudas pai <gurudas.pai@oracle.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/direct-io.c

index 52bb2638f7ab703e9a3d5205b097ddbf90a071e2..6874785bb65a846bafc6eb4242875bac9439ba3c 100644 (file)
@@ -974,6 +974,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
        dio->get_block = get_block;
        dio->end_io = end_io;
        dio->map_bh.b_private = NULL;
+       dio->map_bh.b_state = 0;
        dio->final_block_in_bio = -1;
        dio->next_block_for_io = -1;