From: Tejun Heo <tj@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH driver-core-next] kernfs: fix hash calculation in kernfs_rename_ns()
Date: Mon, 10 Feb 2014 17:57:09 -0500 [thread overview]
Message-ID: <20140210225709.GH25350@mtj.dyndns.org> (raw)
3eef34ad7dc3 ("kernfs: implement kernfs_get_parent(),
kernfs_name/path() and friends") restructured kernfs_rename_ns() such
that new name assignment happens under kernfs_rename_lock;
unfortunately, it mistakenly passed NULL to kernfs_name_hash() to
calculate the new hash if the name hasn't changed, which can lead to
oops.
Fix it by using kn->name and kn->ns when calculating the new hash.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Dan Carpenter dan.carpenter@oracle.com
---
fs/kernfs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 939684e..ba8c858 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -1296,7 +1296,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
spin_unlock_irq(&kernfs_rename_lock);
- kn->hash = kernfs_name_hash(new_name, new_ns);
+ kn->hash = kernfs_name_hash(kn->name, kn->ns);
kernfs_link_sibling(kn);
kernfs_put(old_parent);
next reply other threads:[~2014-02-10 22:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-10 22:57 Tejun Heo [this message]
2014-02-11 0:01 ` Greg Kroah-Hartman
2014-02-11 0:39 ` Tejun Heo
2014-02-11 16:56 ` Greg Kroah-Hartman
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=20140210225709.GH25350@mtj.dyndns.org \
--to=tj@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/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®