[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20221215132236.195e6f3ac1e1cc4e9e012c8f@linux-foundation.org>
Date: Thu, 15 Dec 2022 13:22:36 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Anastasia Belova <abelova@...ralinux.ru>
Cc: 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: Re: [PATCH] mm: Add check for NULL for unlocked in fixup_user_fault
On Thu, 15 Dec 2022 12:39:30 +0300 Anastasia Belova <abelova@...ralinux.ru> wrote:
> Check unlocked for NULL before dereference.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> ...
>
> --- 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;
> }
I don't believe this is necessary unless the caller passed
FAULT_FLAG_KILLABLE or FAULT_FLAG_ALLOW_RETRY in fault_flags.
It's clear as mud and some code comments would help.
Powered by blists - more mailing lists