summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadari Pulavarty <pbadari@us.ibm.com>2007-08-10 13:00:44 -0700
committerWilly Tarreau <w@1wt.eu>2007-08-25 17:24:20 +0200
commit0ded4a4aa1115c6b225a874fe8ef37c777013d3d (patch)
tree55b35d6e755a1f81c10aa0703d0359e8f73f11d5
parentf0ce9d8f0be71fd690db1d37ab44fc026a4ae2b6 (diff)
downloadlwn-0ded4a4aa1115c6b225a874fe8ef37c777013d3d.tar.gz
lwn-0ded4a4aa1115c6b225a874fe8ef37c777013d3d.zip
[PATCH] direct-io: fix error-path crashes
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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r--fs/direct-io.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c
index d9d0833444f5..028699395e6c 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -978,6 +978,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;