From: Greg Kroah-Hartman Date: Thu, 22 Jul 2021 13:53:20 +0000 (+0200) Subject: 5.13-stable patches X-Git-Tag: v5.4.135~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d6a7ee4e0ebb0e8a0d28cfbd0b53e915f0d98ad;p=thirdparty%2Fkernel%2Fstable-queue.git 5.13-stable patches added patches: revert-mm-shmem-fix-shmem_swapin-race-with-swapoff.patch revert-swap-fix-do_swap_page-race-with-swapoff.patch --- diff --git a/queue-5.13/revert-mm-shmem-fix-shmem_swapin-race-with-swapoff.patch b/queue-5.13/revert-mm-shmem-fix-shmem_swapin-race-with-swapoff.patch new file mode 100644 index 00000000000..525d637e870 --- /dev/null +++ b/queue-5.13/revert-mm-shmem-fix-shmem_swapin-race-with-swapoff.patch @@ -0,0 +1,81 @@ +From d653fd524304b2745206e16bdcc079b9b394bfd5 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Thu, 22 Jul 2021 15:46:08 +0200 +Subject: Revert "mm/shmem: fix shmem_swapin() race with swapoff" + +From: Greg Kroah-Hartman + +This reverts commit a533a21b692fc15a6aadfa827b29c7d9989109ca which is +commit 2efa33fc7f6ec94a3a538c1a264273c889be2b36 upstream. + +It should not have been added to the stable trees, sorry about that. + +Link: https://lore.kernel.org/r/YPVgaY6uw59Fqg5x@casper.infradead.org +Reported-by: From: Matthew Wilcox +Cc: Miaohe Lin +Cc: Ying Huang +Cc: Alex Shi +Cc: David Hildenbrand +Cc: Dennis Zhou +Cc: Hugh Dickins +Cc: Johannes Weiner +Cc: Joonsoo Kim +Cc: Matthew Wilcox +Cc: Michal Hocko +Cc: Minchan Kim +Cc: Tim Chen +Cc: Wei Yang +Cc: Yang Shi +Cc: Yu Zhao +Cc: Andrew Morton +Cc: Linus Torvalds +Cc: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + mm/shmem.c | 14 +------------- + 1 file changed, 1 insertion(+), 13 deletions(-) + +--- a/mm/shmem.c ++++ b/mm/shmem.c +@@ -1696,8 +1696,7 @@ static int shmem_swapin_page(struct inod + struct address_space *mapping = inode->i_mapping; + struct shmem_inode_info *info = SHMEM_I(inode); + struct mm_struct *charge_mm = vma ? vma->vm_mm : current->mm; +- struct swap_info_struct *si; +- struct page *page = NULL; ++ struct page *page; + swp_entry_t swap; + int error; + +@@ -1705,12 +1704,6 @@ static int shmem_swapin_page(struct inod + swap = radix_to_swp_entry(*pagep); + *pagep = NULL; + +- /* Prevent swapoff from happening to us. */ +- si = get_swap_device(swap); +- if (!si) { +- error = EINVAL; +- goto failed; +- } + /* Look it up and read it in.. */ + page = lookup_swap_cache(swap, NULL, 0); + if (!page) { +@@ -1772,8 +1765,6 @@ static int shmem_swapin_page(struct inod + swap_free(swap); + + *pagep = page; +- if (si) +- put_swap_device(si); + return 0; + failed: + if (!shmem_confirm_swap(mapping, index, swap)) +@@ -1784,9 +1775,6 @@ unlock: + put_page(page); + } + +- if (si) +- put_swap_device(si); +- + return error; + } + diff --git a/queue-5.13/revert-swap-fix-do_swap_page-race-with-swapoff.patch b/queue-5.13/revert-swap-fix-do_swap_page-race-with-swapoff.patch new file mode 100644 index 00000000000..2963c9fe750 --- /dev/null +++ b/queue-5.13/revert-swap-fix-do_swap_page-race-with-swapoff.patch @@ -0,0 +1,103 @@ +From 4b8817e8e7b08c494784eb7116e5aa1beb492a5f Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Thu, 22 Jul 2021 15:43:47 +0200 +Subject: Revert "swap: fix do_swap_page() race with swapoff" + +From: Greg Kroah-Hartman + +This reverts commit c3b39134bbd088b7dce5e5f342ccd6bb9142fd18 which is +commit 2799e77529c2a25492a4395db93996e3dacd762d upstream. + +It should not have been added to the stable trees, sorry about that. + +Link: https://lore.kernel.org/r/YPVgaY6uw59Fqg5x@casper.infradead.org +Reported-by: From: Matthew Wilcox +Cc: Miaohe Lin +Cc: Ying Huang +Cc: Alex Shi +Cc: David Hildenbrand +Cc: Dennis Zhou +Cc: Hugh Dickins +Cc: Johannes Weiner +Cc: Joonsoo Kim +Cc: Matthew Wilcox +Cc: Michal Hocko +Cc: Minchan Kim +Cc: Tim Chen +Cc: Wei Yang +Cc: Yang Shi +Cc: Yu Zhao +Cc: Andrew Morton +Cc: Linus Torvalds +Cc: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/swap.h | 9 --------- + mm/memory.c | 11 ++--------- + 2 files changed, 2 insertions(+), 18 deletions(-) + +--- a/include/linux/swap.h ++++ b/include/linux/swap.h +@@ -526,15 +526,6 @@ static inline struct swap_info_struct *s + return NULL; + } + +-static inline struct swap_info_struct *get_swap_device(swp_entry_t entry) +-{ +- return NULL; +-} +- +-static inline void put_swap_device(struct swap_info_struct *si) +-{ +-} +- + #define swap_address_space(entry) (NULL) + #define get_nr_swap_pages() 0L + #define total_swap_pages 0L +--- a/mm/memory.c ++++ b/mm/memory.c +@@ -3353,7 +3353,6 @@ vm_fault_t do_swap_page(struct vm_fault + { + struct vm_area_struct *vma = vmf->vma; + struct page *page = NULL, *swapcache; +- struct swap_info_struct *si = NULL; + swp_entry_t entry; + pte_t pte; + int locked; +@@ -3381,16 +3380,14 @@ vm_fault_t do_swap_page(struct vm_fault + goto out; + } + +- /* Prevent swapoff from happening to us. */ +- si = get_swap_device(entry); +- if (unlikely(!si)) +- goto out; + + delayacct_set_flag(current, DELAYACCT_PF_SWAPIN); + page = lookup_swap_cache(entry, vma, vmf->address); + swapcache = page; + + if (!page) { ++ struct swap_info_struct *si = swp_swap_info(entry); ++ + if (data_race(si->flags & SWP_SYNCHRONOUS_IO) && + __swap_count(entry) == 1) { + /* skip swapcache */ +@@ -3559,8 +3556,6 @@ vm_fault_t do_swap_page(struct vm_fault + unlock: + pte_unmap_unlock(vmf->pte, vmf->ptl); + out: +- if (si) +- put_swap_device(si); + return ret; + out_nomap: + pte_unmap_unlock(vmf->pte, vmf->ptl); +@@ -3572,8 +3567,6 @@ out_release: + unlock_page(swapcache); + put_page(swapcache); + } +- if (si) +- put_swap_device(si); + return ret; + } + diff --git a/queue-5.13/series b/queue-5.13/series index 2e38718c90d..53f0ed65d64 100644 --- a/queue-5.13/series +++ b/queue-5.13/series @@ -100,3 +100,5 @@ s390-introduce-proper-type-handling-call_on_stack-ma.patch cifs-prevent-null-deref-in-cifs_compose_mount_option.patch firmware-turris-mox-rwtm-add-marvell-armada-3700-rwt.patch arm64-dts-marvell-armada-37xx-move-firmware-node-to-.patch +revert-swap-fix-do_swap_page-race-with-swapoff.patch +revert-mm-shmem-fix-shmem_swapin-race-with-swapoff.patch