summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2017-08-03 17:43:22 +0530
committerJeff Darcy <jeff@pl.atyp.us>2017-08-07 16:28:45 +0000
commite11296f8e52b7e3b13d21b41d4fa34baea878edf (patch)
tree2d8d76600e48c1a9336651354cce779c10384d3e /xlators/features
parentebc8237d8c445af208446c937f31aa311d1efb2c (diff)
gfapi: Duplicate the buffer sent in setxattr calls
Issue: The caller of glfs_setxattr sends a buffer to set as the value. We create a dict in which the pointer to the value is set. Underlying layers like md-cache take a ref on this dict to store the value for a longer time. But the moment setxattr is complete, the caller of glfs_setxattr can free the value memory. Solution: memcpy the setxattr value to the gluster buffer. Change-Id: I58753fe702e8b7d0f6c4f058714c65d0ad5d7a0a BUG: 1477488 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: https://review.gluster.org/17967 Reviewed-by: soumya k <skoduri@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot.c2
-rw-r--r--xlators/features/upcall/src/upcall.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
index 3c42cb2..c5b4037 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
@@ -421,7 +421,7 @@ br_object_read_sign (inode_t *linked_inode, fd_t *fd, br_object_t *object,
xattr = dict_for_key_value
(GLUSTERFS_SET_OBJECT_SIGNATURE,
- (void *)sign, signature_size (SHA256_DIGEST_LENGTH));
+ (void *)sign, signature_size (SHA256_DIGEST_LENGTH), _gf_true);
if (!xattr) {
gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_SET_SIGN_FAILED,
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c
index e20a2e8..3e1d307 100644
--- a/xlators/features/upcall/src/upcall.c
+++ b/xlators/features/upcall/src/upcall.c
@@ -1876,7 +1876,7 @@ up_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
EXIT_IF_UPCALL_OFF (this, out);
- xattr = dict_for_key_value (name, "", 1);
+ xattr = dict_for_key_value (name, "", 1, _gf_true);
if (!xattr) {
op_errno = ENOMEM;
goto err;
@@ -1964,7 +1964,7 @@ up_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
EXIT_IF_UPCALL_OFF (this, out);
- xattr = dict_for_key_value (name, "", 1);
+ xattr = dict_for_key_value (name, "", 1, _gf_true);
if (!xattr) {
op_errno = ENOMEM;
goto err;