Commit efdc3131 authored by Nick Piggin's avatar Nick Piggin Committed by Linus Torvalds

nobh: nobh_write_end fix

This path mustn't have been tested :( I did attempt to exercise it
by injecting failures here, but I suspect PageMappedToDisk may have
been getting in the way. Will need more of a look, although I think
nobh mode is OK for an -rc1 (it shouldn't eat anyone's data).

Commit 03158cd7 ("fs: restore nobh")
introcduced a NULL deref.  Spotted by the Coverity checker.
Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Cc: Badari Pulavarty <pbadari@us.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cfa76f02
...@@ -2563,7 +2563,7 @@ int nobh_write_end(struct file *file, struct address_space *mapping, ...@@ -2563,7 +2563,7 @@ int nobh_write_end(struct file *file, struct address_space *mapping,
struct page *page, void *fsdata) struct page *page, void *fsdata)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
struct buffer_head *head = NULL; struct buffer_head *head = fsdata;
struct buffer_head *bh; struct buffer_head *bh;
if (!PageMappedToDisk(page)) { if (!PageMappedToDisk(page)) {
...@@ -2584,7 +2584,6 @@ int nobh_write_end(struct file *file, struct address_space *mapping, ...@@ -2584,7 +2584,6 @@ int nobh_write_end(struct file *file, struct address_space *mapping,
unlock_page(page); unlock_page(page);
page_cache_release(page); page_cache_release(page);
head = fsdata;
while (head) { while (head) {
bh = head; bh = head;
head = head->b_this_page; head = head->b_this_page;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment