X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=mm%2Fpage_io.c;h=5f61b54ee1f38e0bb7ae7bee3efe3257f8967a44;hb=1742c0f0554ec9a463f859a63ef0a7ba0a45310a;hp=b6c4ac388209c945d744f2541326411314a1cceb;hpb=48ea2cedde3507941f4549b0d27ed46ed29e39ff;p=karo-tx-linux.git diff --git a/mm/page_io.c b/mm/page_io.c index b6c4ac388209..5f61b54ee1f3 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -22,6 +22,7 @@ #include #include #include +#include #include static struct bio *get_swap_bio(gfp_t gfp_flags, @@ -136,6 +137,7 @@ out: WRITE_ONCE(bio->bi_private, NULL); bio_put(bio); wake_up_process(waiter); + put_task_struct(waiter); } int generic_swapfile_activate(struct swap_info_struct *sis, @@ -378,6 +380,11 @@ int swap_readpage(struct page *page, bool do_poll) goto out; } bdev = bio->bi_bdev; + /* + * Keep this task valid during swap readpage because the oom killer may + * attempt to access it in the page fault retry time check. + */ + get_task_struct(current); bio->bi_private = current; bio_set_op_attrs(bio, REQ_OP_READ, 0); count_vm_event(PSWPIN);