aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-06 16:24:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-06 16:24:49 -0400
commit22eb5aa6c7940861f9603581665b9d9a1c60be30 (patch)
tree22890bcebae5647bcc1a29e7b544a1c5de2b1f8b /drivers/scsi/sg.c
parentd7ca6f8cdffa5765e486edb3dada9121fba8e6aa (diff)
parent015640edb1f346e0b2eda703587c4cd1c310ec1d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (74 commits) [SCSI] sg: fix q->queue_lock on scsi_error_handler path [SCSI] replace __inline with inline [SCSI] a2091: make 2 functions static [SCSI] a3000: make 2 functions static [SCSI] ses: #if 0 the unused ses_match_host() [SCSI] use kmem_cache_zalloc instead of kmem_cache_alloc/memset [SCSI] sg: fix iovec bugs introduced by the block layer conversion [SCSI] qlogicpti: use request_firmware [SCSI] advansys: use request_firmware [SCSI] qla1280: use request_firmware [SCSI] libiscsi: fix iscsi pool error path [SCSI] cxgb3i: call ddp release function directly [SCSI] cxgb3i: merge cxgb3i_ddp into cxgb3i module [SCSI] cxgb3i: close all tcp connections upon chip reset [SCSI] cxgb3i: re-read ddp settings information after chip reset [SCSI] cxgb3i: re-initialize ddp settings after chip reset [SCSI] cxgb3i: subscribe to error notification from cxgb3 driver [SCSI] aacraid driver update [SCSI] mptsas: remove unneeded check [SCSI] config: Make need for SCSI_CDROM clearer ...
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index ffc87851f2e8..82312df9b0bf 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1312,8 +1312,10 @@ static void sg_rq_end_io(struct request *rq, int uptodate)
1312 wake_up_interruptible(&sfp->read_wait); 1312 wake_up_interruptible(&sfp->read_wait);
1313 kill_fasync(&sfp->async_qp, SIGPOLL, POLL_IN); 1313 kill_fasync(&sfp->async_qp, SIGPOLL, POLL_IN);
1314 kref_put(&sfp->f_ref, sg_remove_sfp); 1314 kref_put(&sfp->f_ref, sg_remove_sfp);
1315 } else 1315 } else {
1316 execute_in_process_context(sg_rq_end_io_usercontext, &srp->ew); 1316 INIT_WORK(&srp->ew.work, sg_rq_end_io_usercontext);
1317 schedule_work(&srp->ew.work);
1318 }
1317} 1319}
1318 1320
1319static struct file_operations sg_fops = { 1321static struct file_operations sg_fops = {
@@ -1656,10 +1658,30 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd)
1656 md->null_mapped = hp->dxferp ? 0 : 1; 1658 md->null_mapped = hp->dxferp ? 0 : 1;
1657 } 1659 }
1658 1660
1659 if (iov_count) 1661 if (iov_count) {
1660 res = blk_rq_map_user_iov(q, rq, md, hp->dxferp, iov_count, 1662 int len, size = sizeof(struct sg_iovec) * iov_count;
1661 hp->dxfer_len, GFP_ATOMIC); 1663 struct iovec *iov;
1662 else 1664
1665 iov = kmalloc(size, GFP_ATOMIC);
1666 if (!iov)
1667 return -ENOMEM;
1668
1669 if (copy_from_user(iov, hp->dxferp, size)) {
1670 kfree(iov);
1671 return -EFAULT;
1672 }
1673
1674 len = iov_length(iov, iov_count);
1675 if (hp->dxfer_len < len) {
1676 iov_count = iov_shorten(iov, iov_count, hp->dxfer_len);
1677 len = hp->dxfer_len;
1678 }
1679
1680 res = blk_rq_map_user_iov(q, rq, md, (struct sg_iovec *)iov,
1681 iov_count,
1682 len, GFP_ATOMIC);
1683 kfree(iov);
1684 } else
1663 res = blk_rq_map_user(q, rq, md, hp->dxferp, 1685 res = blk_rq_map_user(q, rq, md, hp->dxferp,
1664 hp->dxfer_len, GFP_ATOMIC); 1686 hp->dxfer_len, GFP_ATOMIC);
1665 1687
@@ -2079,7 +2101,8 @@ static void sg_remove_sfp(struct kref *kref)
2079 write_unlock_irqrestore(&sg_index_lock, iflags); 2101 write_unlock_irqrestore(&sg_index_lock, iflags);
2080 wake_up_interruptible(&sdp->o_excl_wait); 2102 wake_up_interruptible(&sdp->o_excl_wait);
2081 2103
2082 execute_in_process_context(sg_remove_sfp_usercontext, &sfp->ew); 2104 INIT_WORK(&sfp->ew.work, sg_remove_sfp_usercontext);
2105 schedule_work(&sfp->ew.work);
2083} 2106}
2084 2107
2085static int 2108static int