summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorRaghavendra Talur <rtalur@redhat.com>2016-07-04 18:36:26 +0530
committerKaushal M <kaushal@redhat.com>2016-07-07 02:01:01 -0700
commitbddf6f8e6909ea1a3a9f240ca3a7515aea4e35b4 (patch)
tree9a991f0fc8b316f666057bc8ff7aa4f467a69577 /api
parent1a21cfba8e7a5f4ac1b8a8c3b8e06574b237420d (diff)
gfapi: update count when glfs_buf_copy is used
Backport of http://review.gluster.org/#/c/14854 glfs_buf_copy collates all iovecs into a iovec with count=1. If gio->count is not updated it will lead to dereferencing of invalid address. Change-Id: I7c58071d5c6515ec6fee3ab36af206fa80cf37c3 BUG: 1352482 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Signed-off-by: Poornima G <pgurusid@redhat.com> Reported-By: Lindsay Mathieson <lindsay.mathieson@gmail.com> Reported-By: Dmitry Melekhov <dm@belkam.com> Reported-By: Tom Emerson <TEmerson@cyberitas.com> Reviewed-on: http://review.gluster.org/14859 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'api')
-rw-r--r--api/src/glfs-fops.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
index 13815f7..77c8d24 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -1155,12 +1155,13 @@ pub_glfs_pwritev_async (struct glfs_fd *glfd, const struct iovec *iovec,
gio->op = GF_FOP_WRITE;
gio->glfd = glfd;
- gio->count = count;
gio->offset = offset;
gio->flags = flags;
gio->fn = fn;
gio->data = data;
- gio->iov = GF_CALLOC (1, sizeof (*(gio->iov)), gf_common_mt_iovec);
+ gio->count = 1;
+ gio->iov = GF_CALLOC (gio->count, sizeof (*(gio->iov)),
+ gf_common_mt_iovec);
if (!gio->iov) {
errno = ENOMEM;
goto out;