From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Matthew Wilcox <willy@infradead.org>
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: Mon, 18 Dec 2023 11:34:59 +0800 [thread overview]
Message-ID: <874cce7f-4545-450f-9d6b-4f3e3357281b@linux.alibaba.com> (raw)
In-Reply-To: <ZXxqTjZR0OAvjaXr@casper.infradead.org>
On 12/15/2023 11:01 PM, Matthew Wilcox wrote:
> 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?
Yes, I think below check can avoid crash of dentry_name() used by '%pd'.
Maybe we should also initialize on-stack dentry by
struct dentry dentry = { };
I can send a patch with your suggestion. Thanks.
> +++ 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;
next prev parent reply other threads:[~2023-12-18 3:34 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
2023-12-18 3:34 ` Baolin Wang [this message]
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=874cce7f-4545-450f-9d6b-4f3e3357281b@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.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