diff options
author | Hugh Dickins <hughd@google.com> | 2023-07-11 18:27:17 -0700 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-08-18 10:12:17 -0700 |
commit | 597425df4fecd272ca48f73feca7833433c16e12 (patch) | |
tree | a45e941c49a6836ecda3d92f2a632c3f2b90cca3 /mm/userfaultfd.c | |
parent | fc71884a5f599a603fcc3c2b28b3872c09d19c18 (diff) | |
download | lwn-597425df4fecd272ca48f73feca7833433c16e12.tar.gz lwn-597425df4fecd272ca48f73feca7833433c16e12.zip |
mm: userfaultfd: add new UFFDIO_POISON ioctl: fix
Smatch has observed that pte_offset_map_lock() is now allowed to fail, and
then ptl should not be unlocked. Use -EAGAIN here like elsewhere.
Link: https://lkml.kernel.org/r/bc7bba61-d34f-ad3a-ccf1-c191585ef851@google.com
Signed-off-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Axel Rasmussen <axelrasmussen@google.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Peter Xu <peterx@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/userfaultfd.c')
-rw-r--r-- | mm/userfaultfd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index 68157359dc34..dd167184575e 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -300,7 +300,10 @@ static int mfill_atomic_pte_poison(pmd_t *dst_pmd, spinlock_t *ptl; _dst_pte = make_pte_marker(PTE_MARKER_POISONED); + ret = -EAGAIN; dst_pte = pte_offset_map_lock(dst_mm, dst_pmd, dst_addr, &ptl); + if (!dst_pte) + goto out; if (mfill_file_over_size(dst_vma, dst_addr)) { ret = -EFAULT; @@ -319,6 +322,7 @@ static int mfill_atomic_pte_poison(pmd_t *dst_pmd, ret = 0; out_unlock: pte_unmap_unlock(dst_pte, ptl); +out: return ret; } |