diff --git a/mm/filemap.c b/mm/filemap.c index 61ba5e405791918e2bab077144300b1d4d7ab6ce..4ee2e998e937dc4731ce5d2d4af82119d8077ea9 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1029,6 +1029,9 @@ static void do_generic_file_read(struct file *filp, loff_t *ppos, goto page_not_up_to_date; if (!trylock_page(page)) goto page_not_up_to_date; + /* Did it get truncated before we got the lock? */ + if (!page->mapping) + goto page_not_up_to_date_locked; if (!mapping->a_ops->is_partially_uptodate(page, desc, offset)) goto page_not_up_to_date_locked;