[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZXxqTjZR0OAvjaXr@casper.infradead.org>
Date: Fri, 15 Dec 2023 15:01:34 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Baolin Wang <baolin.wang@...ux.alibaba.com>
Cc: akpm@...ux-foundation.org, david@...hat.com, ying.huang@...el.com,
ziy@...dia.com, xuyu@...ux.alibaba.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: migrate: fix getting incorrect page mapping during
page migration
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;
Powered by blists - more mailing lists