+ shmem_swapin_page-fix-error-processing-for-get_swap_device.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: shmem_swapin_page(): fix error processing for get_swap_device()
has been added to the -mm tree.  Its filename is
     shmem_swapin_page-fix-error-processing-for-get_swap_device.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/shmem_swapin_page-fix-error-processing-for-get_swap_device.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/shmem_swapin_page-fix-error-processing-for-get_swap_device.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Huang Ying <ying.huang@xxxxxxxxx>
Subject: shmem_swapin_page(): fix error processing for get_swap_device()

If we hit this rare race, returning EINVAL (or even -EINVAL) would cause
the page fault to be handled as a SIGBUS.  This is not correct; the page
is not missing or unreadable, it has simply changed location.  Returning
-EEXIST here will cause the lookup to be retried by the caller.

[willy@xxxxxxxxxxxxx: changelog]
Link: https://lkml.kernel.org/r/20210723080000.93953-1-ying.huang@xxxxxxxxx
Link: https://lkml.kernel.org/r/877dh354vc.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: 2efa33fc7f6e ("mm/shmem: fix shmem_swapin() race with swapoff")
Signed-off-by: "Huang, Ying" <ying.huang@xxxxxxxxx>
Suggested-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
Cc: Miaohe Lin <linmiaohe@xxxxxxxxxx>
Cc: Hugh Dickins <hughd@xxxxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
Cc: Minchan Kim <minchan@xxxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/shmem.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/shmem.c~shmem_swapin_page-fix-error-processing-for-get_swap_device
+++ a/mm/shmem.c
@@ -1708,8 +1708,8 @@ static int shmem_swapin_page(struct inod
 	/* Prevent swapoff from happening to us. */
 	si = get_swap_device(swap);
 	if (!si) {
-		error = EINVAL;
-		goto failed;
+		error = -EEXIST;
+		goto unlock;
 	}
 	/* Look it up and read it in.. */
 	page = lookup_swap_cache(swap, NULL, 0);
_

Patches currently in -mm which might be from ying.huang@xxxxxxxxx are

shmem_swapin_page-fix-error-processing-for-get_swap_device.patch
mmdo_huge_pmd_numa_page-remove-unnecessary-tlb-flushing-code.patch
mm-migrate-add-sysfs-interface-to-enable-reclaim-migration.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux