readahead: fix NULL filp dereference

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, April 7, 2010 - 9:59 am

Gitweb:     http://git.kernel.org/linus/70655c06bd3f25111312d63985888112aed15ac5
Commit:     70655c06bd3f25111312d63985888112aed15ac5
Parent:     12765517d9dbb477a2432375938f1eb5bdbcb532
Author:     Wu Fengguang <fengguang.wu@intel.com>
AuthorDate: Tue Apr 6 14:34:53 2010 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Wed Apr 7 08:38:03 2010 -0700

    readahead: fix NULL filp dereference
    
    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
    
    Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
    Cc: Yan Zheng <yanzheng@21cn.com>
    Reported-by: Kirill A. Shutemov <kirill@shutemov.name>
    Tested-by: Kirill A. Shutemov <kirill@shutemov.name>
    Cc: <stable@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 mm/readahead.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/readahead.c b/mm/readahead.c
index 999b54b..dfa9a1a 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -503,7 +503,7 @@ void page_cache_sync_readahead(struct address_space *mapping,
 		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;
 	}
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
readahead: fix NULL filp dereference, Linux Kernel Mailing ..., (Wed Apr 7, 9:59 am)