diff --git a/mm/readahead.c b/mm/readahead.c
index 999b54bb462f3ad24ec83b8997aec7c7780bc469..dfa9a1a03a116c7659d0d71134a3450a8d69026f 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;
 	}