]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
f2fs: fix bad prefetchw of NULL page
authorKinglong Mee <kinglongmee@gmail.com>
Mon, 13 Mar 2017 08:35:13 +0000 (16:35 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 22 Mar 2017 02:34:31 +0000 (22:34 -0400)
For f2fs_read_data_pages, the f2fs_mpage_readpages gets "page == NULL",
so that, the prefetchw(&page->flags) is operated on NULL.

Fixes: f1e8866016 ("f2fs: expose f2fs_mpage_readpages")
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c

index e341d446205ab828782bf9bb0226c2056118e692..2c8485bb6eb1e3aa4bba8dfcbb0120eb67601e41 100644 (file)
@@ -1151,9 +1151,10 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
 
        for (page_idx = 0; nr_pages; page_idx++, nr_pages--) {
 
-               prefetchw(&page->flags);
                if (pages) {
                        page = list_last_entry(pages, struct page, lru);
+
+                       prefetchw(&page->flags);
                        list_del(&page->lru);
                        if (add_to_page_cache_lru(page, mapping,
                                                  page->index,