[PATCH][BUGFIX] readahead: fix NULL filp dereference

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Wu Fengguang
Date: Friday, April 2, 2010 - 12:27 am

The btrfs relocate_file_extent_cluster() calls us with NULL filp:

  [ 4005.426805] BUG: unable to handle kernel NULL pointer dereference at 00000021
  [ 4005.426818] IP: [<c109a130>] page_cache_sync_readahead+0x18/0x3e

CC: Yan Zheng <yanzheng@21cn.com>
Reported-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---

Andrew and Greg:

This is an obvious correct bug fix for .34 and .33-stable,
so I'm resending it directly to you without Kirill's confirmation.


--- sound-2.6.orig/mm/readahead.c	2010-03-26 11:51:57.000000000 +0800
+++ sound-2.6/mm/readahead.c	2010-03-26 11:52:11.000000000 +0800
@@ -502,7 +502,7 @@ void page_cache_sync_readahead(struct ad
 		return;
 
 	/* be dumb */
-	if (filp->f_mode & FMODE_RANDOM) {
+	if (filp && (filp->f_mode & FMODE_RANDOM)) {
 		force_page_cache_readahead(mapping, filp, offset, req_size);
 		return;
 	}
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH][BUGFIX] readahead: fix NULL filp dereference, Wu Fengguang, (Fri Apr 2, 12:27 am)
Re: [PATCH][BUGFIX] readahead: fix NULL filp dereference, Kirill A. Shutemov, (Fri Apr 2, 5:18 am)