Эх сурвалжийг харах

[PATCH] drop_buffers() oops fix

In rare situations, drop_buffers() can be called for a page which has buffers,
but no ->mapping (it was truncated, but the buffers were left behind because
ext3 was still fiddling with them).

But if there was an I/O error in a buffer_head, drop_buffers() will try to get
at the address_space and will oops.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
akpm@osdl.org 20 жил өмнө
parent
commit
de7d5a3b6c
1 өөрчлөгдсөн 1 нэмэгдсэн , 1 устгасан
  1. 1 1
      fs/buffer.c

+ 1 - 1
fs/buffer.c

@@ -2917,7 +2917,7 @@ drop_buffers(struct page *page, struct buffer_head **buffers_to_free)
 
 
 	bh = head;
 	bh = head;
 	do {
 	do {
-		if (buffer_write_io_error(bh))
+		if (buffer_write_io_error(bh) && page->mapping)
 			set_bit(AS_EIO, &page->mapping->flags);
 			set_bit(AS_EIO, &page->mapping->flags);
 		if (buffer_busy(bh))
 		if (buffer_busy(bh))
 			goto failed;
 			goto failed;