You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[PATCH] sysfs: fix problem with duplicate sysfs directories and files
The following patch checks for existing sysfs_dirent before preparing new one while creating sysfs directories and files. Signed-off-by: Maneesh Soni <maneesh@in.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
22f98c0cd7
commit
c516865cfb
+3
-2
@@ -82,12 +82,13 @@ exit1:
|
||||
int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name)
|
||||
{
|
||||
struct dentry * dentry = kobj->dentry;
|
||||
int error = 0;
|
||||
int error = -EEXIST;
|
||||
|
||||
BUG_ON(!kobj || !kobj->dentry || !name);
|
||||
|
||||
mutex_lock(&dentry->d_inode->i_mutex);
|
||||
error = sysfs_add_link(dentry, name, target);
|
||||
if (!sysfs_dirent_exist(dentry->d_fsdata, name))
|
||||
error = sysfs_add_link(dentry, name, target);
|
||||
mutex_unlock(&dentry->d_inode->i_mutex);
|
||||
return error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user