]> git.baikalelectronics.ru Git - kernel.git/commit
vfs: Don't call attach_nobh_buffers() with an empty list
authorDave Kleikamp <shaggy@linux.vnet.ibm.com>
Fri, 6 Feb 2009 20:59:26 +0000 (14:59 -0600)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Feb 2009 21:34:22 +0000 (13:34 -0800)
commit0124c47ab96e2df4da564e3845f5d2ddf0b8878e
tree898a0d6b4d8934ec4939a8572e1b78dbb9689d93
parente63124679436b380e2d5b8aee7c1d9ef04672301
vfs: Don't call attach_nobh_buffers() with an empty list

This is a modification of a patch by Bill Pemberton <wfp5p@virginia.edu>

nobh_write_end() could call attach_nobh_buffers() with head == NULL.
This would result in a trap when attach_nobh_buffers() attempted to
access bh->b_this_page.

This can be illustrated by running the writev01 testcase from LTP on jfs.

This error was introduced by commit 7dbe8ae6 "vfs: fix data leak in
nobh_write_end()".  That patch did not take into account that if
PageMappedToDisk() is true upon entry to nobh_write_begin(), then no
buffers will be allocated for the page.  In that case, we won't have to
worry about a failed write leaving unitialized data in the page.

Of course, head != NULL implies !page_has_buffers(page), so no need to
test both.

Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Dmitri Monakhov <dmonakhov@openvz.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/buffer.c