OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 01/14] sysfs: fix i_mutex locking in sysfs_get_dentry()
[PATCH 01/14] sysfs: fix i_mutex locking in sysfs_get_dentry() [message #19732] Mon, 20 August 2007 12:36
Tejun Heo is currently offline  Tejun Heo
Messages: 184
Registered: November 2006
Senior Member
lookup_one_len_kern() should be called with the parent's i_mutex
locked.  Fix it.

Spotted by Eric W. Biederman.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/sysfs/dir.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index e4fd8a2..b33af5e 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -130,8 +130,10 @@ struct dentry *sysfs_get_dentry(struct sysfs_dirent *sd)
 
 		/* look it up */
 		parent_dentry = dentry;
+		mutex_lock(&parent_dentry->d_inode->i_mutex);
 		dentry = lookup_one_len_kern(cur->s_name, parent_dentry,
 					     strlen(cur->s_name));
+		mutex_unlock(&parent_dentry->d_inode->i_mutex);
 		dput(parent_dentry);
 
 		if (IS_ERR(dentry)) {
-- 
1.5.0.3


_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Previous Topic: [PATCH] Isolate the explicit usage of signal->pgrp
Next Topic: [PATCH 09/14] sysfs: Introduce sysfs_rename_mutex
Goto Forum:
  


Current Time: Fri Sep 12 20:17:41 GMT 2025

Total time taken to generate the page: 0.07241 seconds