linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Lorenzo Stoakes <lstoakes@gmail.com>,
	Vlastimil Babka <vbabka@suse.cz>, Jeff Xu <jeffxu@chromium.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] mm/mprotect: Fix do_mprotect_pkey() limit check
Date: Wed, 7 Jun 2023 09:43:14 +0200	[thread overview]
Message-ID: <1b27077f-d4e5-321c-f15e-b1309763806c@redhat.com> (raw)
In-Reply-To: <20230606182912.586576-1-Liam.Howlett@oracle.com>

On 06.06.23 20:29, Liam R. Howlett wrote:
> The return of do_mprotect_pkey() can still be incorrectly returned as
> success if there is a gap that spans to or beyond the end address passed
> in.  Update the check to ensure that the end address has indeed been
> seen.
> 
> Link: https://lore.kernel.org/all/CABi2SkXjN+5iFoBhxk71t3cmunTk-s=rB4T7qo0UQRh17s49PQ@mail.gmail.com/
> Fixes: 82f951340f25 ("mm/mprotect: fix do_mprotect_pkey() return on error")
> Reported-by: Jeff Xu <jeffxu@chromium.org>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> ---
>   mm/mprotect.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/mprotect.c b/mm/mprotect.c
> index 92d3d3ca390a..c59e7561698c 100644
> --- a/mm/mprotect.c
> +++ b/mm/mprotect.c
> @@ -867,7 +867,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len,
>   	}
>   	tlb_finish_mmu(&tlb);
>   
> -	if (!error && vma_iter_end(&vmi) < end)
> +	if (!error && tmp < end)
>   		error = -ENOMEM;
>   
>   out:

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



       reply	other threads:[~2023-06-07  7:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230606182912.586576-1-Liam.Howlett@oracle.com>
2023-06-07  7:43 ` David Hildenbrand [this message]
2023-06-07  7:46 ` Vlastimil Babka

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=1b27077f-d4e5-321c-f15e-b1309763806c@redhat.com \
    --to=david@redhat.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=jeffxu@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=vbabka@suse.cz \
    /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