[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221215093930.22026-1-abelova@astralinux.ru>
Date: Thu, 15 Dec 2022 12:39:30 +0300
From: Anastasia Belova <abelova@...ralinux.ru>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Anastasia Belova <abelova@...ralinux.ru>,
Max Filippov <jcmvbkbc@...il.com>,
Ingo Molnar <mingo@...nel.org>,
Vineet Gupta <vgupta@...nel.org>,
"Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
Geert Uytterhoeven <geert@...ux-m68k.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: [PATCH] mm: Add check for NULL for unlocked in fixup_user_fault
Check unlocked for NULL before dereference.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: d92725256b4f ("mm: avoid unnecessary page fault retires on shared memory types")
Signed-off-by: Anastasia Belova <abelova@...ralinux.ru>
---
mm/gup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/gup.c b/mm/gup.c
index f212d571b563..905d5fb64c4c 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1282,7 +1282,8 @@ int fixup_user_fault(struct mm_struct *mm,
* could tell the callers so they do not need to unlock.
*/
mmap_read_lock(mm);
- *unlocked = true;
+ if (unlocked)
+ *unlocked = true;
return 0;
}
--
2.30.2
Powered by blists - more mailing lists