* [PATCH driver-core-next] kernfs: fix hash calculation in kernfs_rename_ns()
@ 2014-02-10 22:57 Tejun Heo
2014-02-11 0:01 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2014-02-10 22:57 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Dan Carpenter
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);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH driver-core-next] kernfs: fix hash calculation in kernfs_rename_ns()
2014-02-10 22:57 [PATCH driver-core-next] kernfs: fix hash calculation in kernfs_rename_ns() Tejun Heo
@ 2014-02-11 0:01 ` Greg Kroah-Hartman
2014-02-11 0:39 ` Tejun Heo
0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2014-02-11 0:01 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-kernel, Dan Carpenter
On Mon, Feb 10, 2014 at 05:57:09PM -0500, Tejun Heo wrote:
> 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.
Now applied, thanks.
Also, can you look into the merge of 3.14-rc2 into the driver-core-next
branch? There are some conflicts in the kernfs code due to the lockdep
changes that I couldn't easily verify I got right, so I didn't do the
merge. Could you give me a diff of the merge for me to work off of?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH driver-core-next] kernfs: fix hash calculation in kernfs_rename_ns()
2014-02-11 0:01 ` Greg Kroah-Hartman
@ 2014-02-11 0:39 ` Tejun Heo
2014-02-11 16:56 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2014-02-11 0:39 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Dan Carpenter
Hello, Greg.
On Mon, Feb 10, 2014 at 04:01:41PM -0800, Greg Kroah-Hartman wrote:
> Also, can you look into the merge of 3.14-rc2 into the driver-core-next
> branch? There are some conflicts in the kernfs code due to the lockdep
> changes that I couldn't easily verify I got right, so I didn't do the
> merge. Could you give me a diff of the merge for me to work off of?
Sure thing. It can be resolved by simply ignoring the
driver-core-linus side. kernfs_drain() updates in driver-core-next
already has all the necessary lockdep flag checks through
kernfs_lockdep().
The following git branch contains a test merge between
driver-core-next and rc2.
git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git driver-core-next-test-merge-rc2
Thanks!
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH driver-core-next] kernfs: fix hash calculation in kernfs_rename_ns()
2014-02-11 0:39 ` Tejun Heo
@ 2014-02-11 16:56 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2014-02-11 16:56 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-kernel, Dan Carpenter
On Mon, Feb 10, 2014 at 07:39:56PM -0500, Tejun Heo wrote:
> Hello, Greg.
>
> On Mon, Feb 10, 2014 at 04:01:41PM -0800, Greg Kroah-Hartman wrote:
> > Also, can you look into the merge of 3.14-rc2 into the driver-core-next
> > branch? There are some conflicts in the kernfs code due to the lockdep
> > changes that I couldn't easily verify I got right, so I didn't do the
> > merge. Could you give me a diff of the merge for me to work off of?
>
> Sure thing. It can be resolved by simply ignoring the
> driver-core-linus side. kernfs_drain() updates in driver-core-next
> already has all the necessary lockdep flag checks through
> kernfs_lockdep().
>
> The following git branch contains a test merge between
> driver-core-next and rc2.
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git driver-core-next-test-merge-rc2
Thanks, I took this merge and pulled it into my tree.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-11 16:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-10 22:57 [PATCH driver-core-next] kernfs: fix hash calculation in kernfs_rename_ns() Tejun Heo
2014-02-11 0:01 ` Greg Kroah-Hartman
2014-02-11 0:39 ` Tejun Heo
2014-02-11 16:56 ` Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.