diff options
author | David Spisla <david.spisla@iternity.com> | 2019-06-19 13:07:56 +0200 |
---|---|---|
committer | gluster-ant <bugzilla-bot@gluster.org> | 2019-06-19 13:07:56 +0200 |
commit | f6cbf58ec1dfe19b31a87a626e796415b32b7844 (patch) | |
tree | 037ab211ef63d76d9b99720abaef1cfd1976e7f6 | |
parent | 65c8b525fa64a4040118a8671f45a762660a1420 (diff) | |
download | glusterfs-f6cbf58ec1dfe19b31a87a626e796415b32b7844.tar.gz glusterfs-f6cbf58ec1dfe19b31a87a626e796415b32b7844.tar.xz glusterfs-f6cbf58ec1dfe19b31a87a626e796415b32b7844.zip |
WORM-Xlator: Avoid performing fsetxattr if fd is NULL
If worm_create_cbk receives an error (op_ret == -1) fd will be NULL
and therefore performing fsetxattr would lead to a segfault and the
brick process crashes. To avoid this we allow setting fsetxattr only
if op_ret >= 0 . If an error happens we explicitly unwind
Change-Id: Ie7f8a198add93e5cd908eb7029cffc834c3b58a6
fixes: bz#1717757
Signed-off-by: David Spisla <david.spisla@iternity.com>
-rw-r--r-- | xlators/features/read-only/src/worm.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xlators/features/read-only/src/worm.c b/xlators/features/read-only/src/worm.c index cc3d15b8b2..f59663802e 100644 --- a/xlators/features/read-only/src/worm.c +++ b/xlators/features/read-only/src/worm.c @@ -429,6 +429,13 @@ worm_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this, read_only_priv_t *priv = NULL; dict_t *dict = NULL; + // In case of an error exit because fd can be NULL and this would + // cause an segfault when performing fsetxattr . We explicitly + // unwind to avoid future problems + if (op_ret < 0) { + goto out; + } + priv = this->private; GF_ASSERT(priv); if (priv->worm_file) { |