summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiffin Tony Thottan <jthottan@redhat.com>2018-01-17 18:03:11 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-01-19 14:57:52 +0000
commit594345737f0a49cd6a17a724102d587f82b4cbb9 (patch)
tree8c96504ded9e773c959ff1b9725cb26414e685b6
parentb9e3b7f2753a5c8d56c1ed627a22dca3f2c3dd89 (diff)
selinux-xlator : validate dict before calling dict_rename_key()
Upstream reference : >Change-Id: I71da3b64e5e8c82e8842e119b2b05da3e2ace550 >BUG: 1535772 >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> >(cherry picked from commit bee06ccd7b80e3f5804f0c7c7c56936fed6d2b4e) Change-Id: I71da3b64e5e8c82e8842e119b2b05da3e2ace550 BUG: 1536294
-rw-r--r--xlators/features/selinux/src/selinux.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/xlators/features/selinux/src/selinux.c b/xlators/features/selinux/src/selinux.c
index 1a4b39f253c..386bce1bc44 100644
--- a/xlators/features/selinux/src/selinux.c
+++ b/xlators/features/selinux/src/selinux.c
@@ -22,7 +22,7 @@ selinux_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int ret = 0;
char *name = cookie;
- if (op_errno == 0 && name && (!strcmp(name, SELINUX_GLUSTER_XATTR))) {
+ if (op_errno == 0 && dict && name && (!strcmp(name, SELINUX_GLUSTER_XATTR))) {
ret = dict_rename_key (dict, SELINUX_GLUSTER_XATTR,
SELINUX_XATTR);
if (ret < 0)
@@ -77,7 +77,7 @@ selinux_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int ret = 0;
char *name = cookie;
- if (op_errno == 0 && name && (!strcmp(name, SELINUX_GLUSTER_XATTR))) {
+ if (op_errno == 0 && dict && name && (!strcmp(name, SELINUX_GLUSTER_XATTR))) {
ret = dict_rename_key (dict, SELINUX_GLUSTER_XATTR,
SELINUX_XATTR);
if (ret < 0)
@@ -147,7 +147,7 @@ selinux_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
GF_VALIDATE_OR_GOTO ("selinux", priv, err);
- if (!priv->selinux_enabled)
+ if (!priv->selinux_enabled && !dict)
goto off;
ret = dict_rename_key (dict, SELINUX_XATTR, SELINUX_GLUSTER_XATTR);
@@ -189,7 +189,7 @@ selinux_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
GF_VALIDATE_OR_GOTO ("selinux", priv, err);
- if (!priv->selinux_enabled)
+ if (!priv->selinux_enabled && !dict)
goto off;
ret = dict_rename_key (dict, SELINUX_XATTR, SELINUX_GLUSTER_XATTR);