mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/khugepaged: fix a tracepoint for error cases
Date: Tue, 1 Apr 2025 14:09:38 -0700	[thread overview]
Message-ID: <20250401140938.34993d9922eb1e71ba2b2ff8@linux-foundation.org> (raw)
In-Reply-To: <20250401202354.103501-2-sweettea-kernel@dorminy.me>

On Tue,  1 Apr 2025 16:23:53 -0400 Sweet Tea Dorminy <sweettea-kernel@dorminy.me> wrote:

> Fix a potential NULL pointer dereference in trace_mm_khugepaged_scan_pmd()
> when folio is NULL. This is possible if vm_normal_page() returned a NULL
> page -- which is unlikely, but was hit in testing.
> 
> (The tracepoint in include/trace/events/huge_memory.h can already deal
> with a NULL page.)
>
> ...
>
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -1435,8 +1435,9 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
>  		*mmap_locked = false;
>  	}
>  out:
> -	trace_mm_khugepaged_scan_pmd(mm, &folio->page, writable, referenced,
> -				     none_or_zero, result, unmapped);
> +	trace_mm_khugepaged_scan_pmd(mm, folio ? &folio->page : NULL,
> +				     writable, referenced, none_or_zero,
> +				     result, unmapped);
>  	return result;

Confused.  If folio==NULL then &folio->page==NULL also.  The patch
appears to be a no-op?

Do you have the messages from that oops?

      reply	other threads:[~2025-04-01 21:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01 20:23 Sweet Tea Dorminy
2025-04-01 21:09 ` Andrew Morton [this message]

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=20250401140938.34993d9922eb1e71ba2b2ff8@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sweettea-kernel@dorminy.me \
    /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

all inboxes | Powered by JetHome®