From 3d968242f88fd03addbd4c0b178fc3c393f943d5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 22 Feb 2019 22:24:12 +0800 Subject: [PATCH] mm/page_io.c: fix polled swap page in mainline inclusion from mainline-5.0 commit b685a7350ae76bc0f388e24b36d06a63776c68ee category: bugfix bugzilla: 10489 CVE: NA ------------------------------------------------- swap_readpage() wants to do polling to bring in pages if asked to, but it doesn't mark the bio as being polled. Additionally, the looping around the blk_poll() check isn't correct - if we get a zero return, we should call io_schedule(), we can't just assume that the bio has completed. The regular bio->bi_private check should be used for that. Link: http://lkml.kernel.org/r/e15243a8-2cdf-c32c-ecee-f289377c8ef9@kernel.dk Signed-off-by: Jens Axboe Reviewed-by: Andrew Morton Cc: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds [houtao: no spin parameter for blk_poll() and no REQ_HIPRI] Signed-off-by: Hou Tao Conflicts: mm/page_io.c Reviewed-by: yangerkun Signed-off-by: Yang Yingliang --- mm/page_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_io.c b/mm/page_io.c index aafd19ec1db4..d6171e37ac7f 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -410,7 +410,7 @@ int swap_readpage(struct page *page, bool synchronous) break; if (!blk_poll(disk->queue, qc)) - break; + io_schedule(); } __set_current_state(TASK_RUNNING); bio_put(bio); -- GitLab