diff options
author | Jiffin Tony Thottan <jthottan@redhat.com> | 2016-06-23 12:20:03 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2016-07-04 06:24:06 -0700 |
commit | 4063e5763df30e3b5c7d553fcdfe1bab3830cee1 (patch) | |
tree | 4fb957b4184600b75d7997f39f1e3ccc8b859806 /api | |
parent | 021813ca53762f09cb9f43d740a6aaab5659aa51 (diff) |
gfapi : check the value "iovec" in glfs_io_async_cbk only for read
The glfs_io_async_cbk() is called from the cbk of all the async ops
such as write, read, fsync, ftruncate. In all other cases, expect for
read the value for "iovec" is NULL. From the code, glfs_io_async_cbk
checks the value in common routine which may end up in failures.
Thanks Joe Julian for finding issue and suggesting the fix.
Upstream reference
>Change-Id: I0be0123da68f9d8fbb5d94ede2d45566a9add6a5
>BUG: 1349276
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
>Reported-by: Joe Julian <me@joejulian.name>
>Reviewed-on: http://review.gluster.org/14779
>Reviewed-by: Niels de Vos <ndevos@redhat.com>
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Joe Julian <me@joejulian.name>
>(cherry picked from commit 61d72b3d91f2655b04de4ef29262f738a8cf7369)
Change-Id: I0be0123da68f9d8fbb5d94ede2d45566a9add6a5
BUG: 1350789
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reported-by: Joe Julian <me@joejulian.name>
Reviewed-on: http://review.gluster.org/14821
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Poornima G <pgurusid@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'api')
-rw-r--r-- | api/src/glfs-fops.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 48bbf224d87..5209ce3959a 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -803,7 +803,6 @@ glfs_io_async_cbk (int op_ret, int op_errno, call_frame_t *frame, GF_VALIDATE_OR_GOTO ("gfapi", frame, inval); GF_VALIDATE_OR_GOTO ("gfapi", cookie, inval); - GF_VALIDATE_OR_GOTO ("gfapi", iovec, inval); gio = frame->local; frame->local = NULL; @@ -817,6 +816,12 @@ glfs_io_async_cbk (int op_ret, int op_errno, call_frame_t *frame, if (op_ret <= 0) { goto out; } else if (gio->op == GF_FOP_READ) { + if (!iovec) { + op_ret = -1; + op_errno = EINVAL; + goto out; + } + op_ret = iov_copy (gio->iov, gio->count, iovec, count); glfd->offset = gio->offset + op_ret; } else if (gio->op == GF_FOP_WRITE) { |