aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2017-03-20 12:02:33 +0800
committerAlex Shi <alex.shi@linaro.org>2017-03-20 12:02:33 +0800
commit156f7b56ee4b918b95991750e0f34da8ad416eae (patch)
treefd47da260b3c78631721f36edf01b2878358283a /drivers/scsi/sg.c
parent2e2fb031287a5946d97b85769f80ca60f0166e15 (diff)
parentd97f745e1d2fea4d2f308e5e06eee81a9a84f3f5 (diff)
Merge branch 'linux-linaro-lsk-v4.1' into linux-linaro-lsk-v4.1-rtlsk-v4.1-17.06-rtlsk-v4.1-17.05-rtlsk-v4.1-17.03-rtlinux-linaro-lsk-v4.1-rt
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 26bc4e9c7441..0cc067ce5715 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1757,6 +1757,10 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
return res;
iov_iter_truncate(&i, hp->dxfer_len);
+ if (!iov_iter_count(&i)) {
+ kfree(iov);
+ return -EINVAL;
+ }
res = blk_rq_map_user_iov(q, rq, md, &i, GFP_ATOMIC);
kfree(iov);