Skip to content

Commit

Permalink
direct-io: fix error-path crashes
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Joe Jin <[email protected]>
Acked-by: Zach Brown <[email protected]>
Cc: gurudas pai <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Badari Pulavarty authored and Linus Torvalds committed Aug 11, 2007
1 parent b291aa7 commit 6a648fa
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/direct-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 6a648fa

Please sign in to comment.