Commit 70655c06bd3f25111312d63985888112aed15ac5

Authored by Wu Fengguang
Committed by Linus Torvalds
1 parent 12765517d9

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>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -503,7 +503,7 @@
503 503 return;
504 504  
505 505 /* be dumb */
506   - if (filp->f_mode & FMODE_RANDOM) {
  506 + if (filp && (filp->f_mode & FMODE_RANDOM)) {
507 507 force_page_cache_readahead(mapping, filp, offset, req_size);
508 508 return;
509 509 }