Skip to contentSkip to conversation

9p: correctly check empty xattr key

PATCH In review Taesoo Kim 2 participants 2 messages Mar 20, 2015 – Mar 23, 2015 9P file system

lore
Share & tools
lore

Taesoo Kim

author
#0 lore raw

PATCH 1/1 9p: correctly check empty xattr key

When xattr name (key) is empty (""), correctly return -EINVAL error. Not sure how previous xattr_set_acl() performs with any xattr key for get/set().

---
 fs/9p/acl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/9p/acl.c +2 -2
index 8482f2d..295bf25 100644
@@ -237,7 +237,7 @@ static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name,
 	struct posix_acl *acl;
 	int error;
 
-	if (strcmp(name, "") != 0)
+	if (strcmp(name, "") == 0)
 		return -EINVAL;
 
 	v9ses = v9fs_dentry2v9ses(dentry);
@@ -287,7 +287,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
 	struct v9fs_session_info *v9ses;
 	struct inode *inode = dentry->d_inode;
 
-	if (strcmp(name, "") != 0)
+	if (strcmp(name, "") == 0)
 		return -EINVAL;
 
 	v9ses = v9fs_dentry2v9ses(dentry);
Signature · 1 line
2.3.3
#1 lore raw
Quoted 3 lines · Taesoo Kim

When xattr name (key) is empty (""), correctly return -EINVAL error. Not sure how previous xattr_set_acl() performs with any xattr key for get/set().

Did you test this ?

Quoted 11 lines
---
 fs/9p/acl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/9p/acl.c +0 -0
index 8482f2d..295bf25 100644

fs/9p/acl.c static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, · line 241

Quoted 6 lines
fs/9p/acl.c +1 -1
@@ -237,7 +237,7 @@ static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name,
 	struct posix_acl *acl;
 	int error;
 
-	if (strcmp(name, "") != 0)
+	if (strcmp(name, "") == 0)
 		return -EINVAL;

We get the name in get_acl callback after xattr_resolve_name. ie, the value of name is

name = strcmp_prefix(passed_name, "system.posix_acl_access"); We should find that name "" isn't it ?

Quoted 19 lines
fs/9p/acl.c +1 -1
 	v9ses = v9fs_dentry2v9ses(dentry);
@@ -287,7 +287,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
 	struct v9fs_session_info *v9ses;
 	struct inode *inode = dentry->d_inode;
 
-	if (strcmp(name, "") != 0)
+	if (strcmp(name, "") == 0)
 		return -EINVAL;
 
 	v9ses = v9fs_dentry2v9ses(dentry);
Signature · 7 lines
2.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/