linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Anastasia Belova <abelova@astralinux.ru>
Cc: Max Filippov <jcmvbkbc@gmail.com>, Ingo Molnar <mingo@kernel.org>,
	Vineet Gupta <vgupta@kernel.org>,
	"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org
Subject: Re: [PATCH] mm: Add check for NULL for unlocked in fixup_user_fault
Date: Thu, 15 Dec 2022 13:22:36 -0800	[thread overview]
Message-ID: <20221215132236.195e6f3ac1e1cc4e9e012c8f@linux-foundation.org> (raw)
In-Reply-To: <20221215093930.22026-1-abelova@astralinux.ru>

On Thu, 15 Dec 2022 12:39:30 +0300 Anastasia Belova <abelova@astralinux.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.


           reply	other threads:[~2022-12-15 21:22 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20221215093930.22026-1-abelova@astralinux.ru>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221215132236.195e6f3ac1e1cc4e9e012c8f@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=abelova@astralinux.ru \
    --cc=geert@linux-m68k.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=mingo@kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=vgupta@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox