aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/sg.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 2968c6b83ddb..78d616315d8e 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1686,14 +1686,9 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd)
1686 int len, size = sizeof(struct sg_iovec) * iov_count; 1686 int len, size = sizeof(struct sg_iovec) * iov_count;
1687 struct iovec *iov; 1687 struct iovec *iov;
1688 1688
1689 iov = kmalloc(size, GFP_ATOMIC); 1689 iov = memdup_user(hp->dxferp, size);
1690 if (!iov) 1690 if (IS_ERR(iov))
1691 return -ENOMEM; 1691 return PTR_ERR(iov);
1692
1693 if (copy_from_user(iov, hp->dxferp, size)) {
1694 kfree(iov);
1695 return -EFAULT;
1696 }
1697 1692
1698 len = iov_length(iov, iov_count); 1693 len = iov_length(iov, iov_count);
1699 if (hp->dxfer_len < len) { 1694 if (hp->dxfer_len < len) {