From b14cde343ade10db7b7d9bafc0b631ac2599161e Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Wed, 12 Oct 2011 22:02:43 +0000 Subject: [PATCH] --- yaml --- r: 266872 b: refs/heads/master c: 903e21e2eea036f6947f523f732e28b33a63ed0f h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/sysfs/dir.c | 14 ++++++++++++++ trunk/fs/sysfs/file.c | 3 --- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index bd754ffb8456..407be9e0c2e7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 23396180a9770df2c6a694bbb689c12bdf792f94 +refs/heads/master: 903e21e2eea036f6947f523f732e28b33a63ed0f diff --git a/trunk/fs/sysfs/dir.c b/trunk/fs/sysfs/dir.c index 352d26d98c0a..26f370a9b5ce 100644 --- a/trunk/fs/sysfs/dir.c +++ b/trunk/fs/sysfs/dir.c @@ -384,6 +384,13 @@ int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) { struct sysfs_inode_attrs *ps_iattr; + if (!!sysfs_ns_type(acxt->parent_sd) != !!sd->s_ns) { + WARN(1, KERN_WARNING "sysfs: ns %s in '%s' for '%s'\n", + sysfs_ns_type(acxt->parent_sd)? "required": "invalid", + acxt->parent_sd->s_name, sd->s_name); + return -EINVAL; + } + if (sysfs_find_dirent(acxt->parent_sd, sd->s_ns, sd->s_name)) return -EEXIST; @@ -542,6 +549,13 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, { struct sysfs_dirent *sd; + if (!!sysfs_ns_type(parent_sd) != !!ns) { + WARN(1, KERN_WARNING "sysfs: ns %s in '%s' for '%s'\n", + sysfs_ns_type(parent_sd)? "required": "invalid", + parent_sd->s_name, name); + return NULL; + } + for (sd = parent_sd->s_dir.children; sd; sd = sd->s_sibling) { if (sd->s_ns != ns) continue; diff --git a/trunk/fs/sysfs/file.c b/trunk/fs/sysfs/file.c index 07c1b4ec00df..d4e6080b4b20 100644 --- a/trunk/fs/sysfs/file.c +++ b/trunk/fs/sysfs/file.c @@ -466,9 +466,6 @@ void sysfs_notify(struct kobject *k, const char *dir, const char *attr) mutex_lock(&sysfs_mutex); if (sd && dir) - /* Only directories are tagged, so no need to pass - * a tag explicitly. - */ sd = sysfs_find_dirent(sd, NULL, dir); if (sd && attr) sd = sysfs_find_dirent(sd, NULL, attr);