linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: akpm@linux-foundation.org, david@redhat.com,
	ying.huang@intel.com, ziy@nvidia.com, xuyu@linux.alibaba.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: migrate: fix getting incorrect page mapping during page migration
Date: Fri, 15 Dec 2023 15:01:34 +0000	[thread overview]
Message-ID: <ZXxqTjZR0OAvjaXr@casper.infradead.org> (raw)
In-Reply-To: <ZXxn/0oixJxxAnpF@casper.infradead.org>

On Fri, Dec 15, 2023 at 02:51:43PM +0000, Matthew Wilcox wrote:
> I'm not saying no to this fix, but dump_mapping() is supposed to be
> resilient against this.  Is the issue that 'dentry' is NULL, or is it
> some field within dentry that is NULL?  eg, would this fix your
> case?

Uh, dentry is an on-stack dentry.  So obviously it's a pointer within it
that's NULL.  Maybe this, having stared at the implementation of %pd?

+++ b/fs/inode.c
@@ -588,7 +588,8 @@ void dump_mapping(const struct address_space *mapping)
        }

        dentry_ptr = container_of(dentry_first, struct dentry, d_u.d_alias);
-       if (get_kernel_nofault(dentry, dentry_ptr)) {
+       if (get_kernel_nofault(dentry, dentry_ptr) ||
+           !dentry->d_parent || !dentry->d_name) {
                pr_warn("aops:%ps ino:%lx invalid dentry:%px\n",
                                a_ops, ino, dentry_ptr);
                return;



  reply	other threads:[~2023-12-15 15:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 12:07 Baolin Wang
2023-12-15 14:51 ` Matthew Wilcox
2023-12-15 15:01   ` Matthew Wilcox [this message]
2023-12-18  3:34     ` Baolin Wang
2023-12-18  5:19 ` Huang, Ying

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=ZXxqTjZR0OAvjaXr@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=xuyu@linux.alibaba.com \
    --cc=ying.huang@intel.com \
    --cc=ziy@nvidia.com \
    /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