[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140210225709.GH25350@mtj.dyndns.org>
Date: Mon, 10 Feb 2014 17:57:09 -0500
From: Tejun Heo <tj@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: [PATCH driver-core-next] kernfs: fix hash calculation in
kernfs_rename_ns()
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@...nel.org>
Reported-by: Dan Carpenter dan.carpenter@...cle.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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists