diff options
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/file.c | 6 | ||||
-rw-r--r-- | fs/sysfs/inode.c | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 62f4fb37789e..00012e31829d 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -493,6 +493,12 @@ int sysfs_attr_ns(struct kobject *kobj, const struct attribute *attr, | |||
493 | const void *ns = NULL; | 493 | const void *ns = NULL; |
494 | int err; | 494 | int err; |
495 | 495 | ||
496 | if (!dir_sd) { | ||
497 | WARN(1, KERN_ERR "sysfs: kobject %s without dirent\n", | ||
498 | kobject_name(kobj)); | ||
499 | return -ENOENT; | ||
500 | } | ||
501 | |||
496 | err = 0; | 502 | err = 0; |
497 | if (!sysfs_ns_type(dir_sd)) | 503 | if (!sysfs_ns_type(dir_sd)) |
498 | goto out; | 504 | goto out; |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 0ac3e1c1a7d8..4291fd1617ab 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -315,8 +315,11 @@ int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const void *ns, const cha | |||
315 | struct sysfs_addrm_cxt acxt; | 315 | struct sysfs_addrm_cxt acxt; |
316 | struct sysfs_dirent *sd; | 316 | struct sysfs_dirent *sd; |
317 | 317 | ||
318 | if (!dir_sd) | 318 | if (!dir_sd) { |
319 | WARN(1, KERN_WARNING "sysfs: can not remove '%s', no directory\n", | ||
320 | name); | ||
319 | return -ENOENT; | 321 | return -ENOENT; |
322 | } | ||
320 | 323 | ||
321 | sysfs_addrm_start(&acxt, dir_sd); | 324 | sysfs_addrm_start(&acxt, dir_sd); |
322 | 325 | ||