diff options
author | Poornima G <pgurusid@redhat.com> | 2017-08-03 17:43:22 +0530 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-08-07 16:28:45 +0000 |
commit | e11296f8e52b7e3b13d21b41d4fa34baea878edf (patch) | |
tree | 2d8d76600e48c1a9336651354cce779c10384d3e /libglusterfs/src/dict.h | |
parent | ebc8237d8c445af208446c937f31aa311d1efb2c (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 'libglusterfs/src/dict.h')
-rw-r--r-- | libglusterfs/src/dict.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libglusterfs/src/dict.h b/libglusterfs/src/dict.h index b1ba3c20234..93ffa3e8cc7 100644 --- a/libglusterfs/src/dict.h +++ b/libglusterfs/src/dict.h @@ -256,7 +256,8 @@ gf_boolean_t dict_match_everything (dict_t *d, char *k, data_t *v, void *data); dict_t * -dict_for_key_value (const char *name, const char *value, size_t size); +dict_for_key_value (const char *name, const char *value, size_t size, + gf_boolean_t is_static); gf_boolean_t are_dicts_equal (dict_t *one, dict_t *two, |