git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
fs
/
sysfs
/
symlink.c
diff --git
a/fs/sysfs/symlink.c
b/fs/sysfs/symlink.c
index
d2eac3c
..
f50e3cc
100644
(file)
--- a/
fs/sysfs/symlink.c
+++ b/
fs/sysfs/symlink.c
@@
-3,6
+3,7
@@
*/
#include <linux/fs.h>
*/
#include <linux/fs.h>
+#include <linux/mount.h>
#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/namei.h>
#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/namei.h>
@@
-82,10
+83,19
@@
exit1:
*/
int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name)
{
*/
int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name)
{
- struct dentry *
dentry = kobj->dentry
;
+ struct dentry *
dentry = NULL
;
int error = -EEXIST;
int error = -EEXIST;
- BUG_ON(!kobj || !kobj->dentry || !name);
+ BUG_ON(!name);
+
+ if (!kobj) {
+ if (sysfs_mount && sysfs_mount->mnt_sb)
+ dentry = sysfs_mount->mnt_sb->s_root;
+ } else
+ dentry = kobj->dentry;
+
+ if (!dentry)
+ return -EFAULT;
mutex_lock(&dentry->d_inode->i_mutex);
if (!sysfs_dirent_exist(dentry->d_fsdata, name))
mutex_lock(&dentry->d_inode->i_mutex);
if (!sysfs_dirent_exist(dentry->d_fsdata, name))