12a457
From 9a0e5ff6413048fb2367b0d7532ebb9ae3d4fc90 Mon Sep 17 00:00:00 2001
12a457
From: Jiffin Tony Thottan <jthottan@redhat.com>
12a457
Date: Thu, 23 Jun 2016 12:20:03 +0530
12a457
Subject: [PATCH 198/198] gfapi : check the value "iovec" in glfs_io_async_cbk only for read
12a457
12a457
The glfs_io_async_cbk() is called from the cbk of all the async ops
12a457
such as write, read, fsync, ftruncate. In all other cases, expect for
12a457
read the value for "iovec" is NULL. From the code, glfs_io_async_cbk
12a457
checks the value in common routine which may end up in failures.
12a457
12a457
Thanks Joe Julian for finding issue and suggesting the fix.
12a457
12a457
Backport of:
12a457
Cherry picked from commit 82a5e6cdacd9310f04830c47fd22e0aa9b7b7251:
12a457
> Cherry picked from commit 61d72b3d91f2655b04de4ef29262f738a8cf7369:
12a457
>> Change-Id: I0be0123da68f9d8fbb5d94ede2d45566a9add6a5
12a457
>> BUG: 1349276
12a457
>> Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
12a457
>> Reported-by: Joe Julian <me@joejulian.name>
12a457
>> Reviewed-on: http://review.gluster.org/14779
12a457
>> Reviewed-by: Niels de Vos <ndevos@redhat.com>
12a457
>> Smoke: Gluster Build System <jenkins@build.gluster.org>
12a457
>> Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
12a457
>> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
12a457
>> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
12a457
>> Reviewed-by: Joe Julian <me@joejulian.name>
12a457
12a457
> Change-Id: I0be0123da68f9d8fbb5d94ede2d45566a9add6a5
12a457
> BUG: 1350880
12a457
> Reported-by: Joe Julian <me@joejulian.name>
12a457
> Signed-off-by: Niels de Vos <ndevos@redhat.com>
12a457
> Reviewed-on: http://review.gluster.org/14822
12a457
> Smoke: Gluster Build System <jenkins@build.gluster.org>
12a457
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
12a457
> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
12a457
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
12a457
> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
12a457
12a457
this fixes BZ 1369412 as well
12a457
12a457
Change-Id: Ifbc280535c39f7983a9bcb2e85eb08371c18a791
12a457
BUG: 1369390
12a457
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
12a457
Reviewed-on: https://code.engineering.redhat.com/gerrit/82404
12a457
Reviewed-by: Jiffin Thottan <jthottan@redhat.com>
12a457
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
12a457
---
12a457
 api/src/glfs-fops.c |    7 ++++++-
12a457
 1 files changed, 6 insertions(+), 1 deletions(-)
12a457
12a457
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
12a457
index e396221..62a17f2 100644
12a457
--- a/api/src/glfs-fops.c
12a457
+++ b/api/src/glfs-fops.c
12a457
@@ -743,7 +743,6 @@ glfs_io_async_cbk (int op_ret, int op_errno, call_frame_t *frame,
12a457
 
12a457
         GF_VALIDATE_OR_GOTO ("gfapi", frame, inval);
12a457
         GF_VALIDATE_OR_GOTO ("gfapi", cookie, inval);
12a457
-        GF_VALIDATE_OR_GOTO ("gfapi", iovec, inval);
12a457
 
12a457
         gio = frame->local;
12a457
         frame->local = NULL;
12a457
@@ -757,6 +756,12 @@ glfs_io_async_cbk (int op_ret, int op_errno, call_frame_t *frame,
12a457
         if (op_ret <= 0) {
12a457
                 goto out;
12a457
         } else if (gio->op == GF_FOP_READ) {
12a457
+                if (!iovec) {
12a457
+                        op_ret = -1;
12a457
+                        op_errno = EINVAL;
12a457
+                        goto out;
12a457
+                }
12a457
+
12a457
                 op_ret = iov_copy (gio->iov, gio->count, iovec, count);
12a457
                 glfd->offset = gio->offset + op_ret;
12a457
         } else if (gio->op == GF_FOP_WRITE) {
12a457
-- 
12a457
1.7.1
12a457