diff options
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r-- | drivers/scsi/sg.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 7405d0df95db..b098942445ec 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -748,6 +748,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, | |||
748 | /* | 748 | /* |
749 | * most likely out of mem, but could also be a bad map | 749 | * most likely out of mem, but could also be a bad map |
750 | */ | 750 | */ |
751 | sg_finish_rem_req(srp); | ||
751 | return -ENOMEM; | 752 | return -ENOMEM; |
752 | } else | 753 | } else |
753 | return 0; | 754 | return 0; |
@@ -1044,7 +1045,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
1044 | if (!sg_allow_access(opcode, sdp->device->type)) | 1045 | if (!sg_allow_access(opcode, sdp->device->type)) |
1045 | return -EPERM; | 1046 | return -EPERM; |
1046 | } | 1047 | } |
1047 | return scsi_ioctl_send_command(sdp->device, p); | 1048 | return sg_scsi_ioctl(filp, sdp->device->request_queue, NULL, p); |
1048 | case SG_SET_DEBUG: | 1049 | case SG_SET_DEBUG: |
1049 | result = get_user(val, ip); | 1050 | result = get_user(val, ip); |
1050 | if (result) | 1051 | if (result) |
@@ -1798,8 +1799,10 @@ sg_build_direct(Sg_request * srp, Sg_fd * sfp, int dxfer_len) | |||
1798 | res = st_map_user_pages(schp->buffer, mx_sc_elems, | 1799 | res = st_map_user_pages(schp->buffer, mx_sc_elems, |
1799 | (unsigned long)hp->dxferp, dxfer_len, | 1800 | (unsigned long)hp->dxferp, dxfer_len, |
1800 | (SG_DXFER_TO_DEV == hp->dxfer_direction) ? 1 : 0); | 1801 | (SG_DXFER_TO_DEV == hp->dxfer_direction) ? 1 : 0); |
1801 | if (res <= 0) | 1802 | if (res <= 0) { |
1803 | sg_remove_scat(schp); | ||
1802 | return 1; | 1804 | return 1; |
1805 | } | ||
1803 | schp->k_use_sg = res; | 1806 | schp->k_use_sg = res; |
1804 | schp->dio_in_use = 1; | 1807 | schp->dio_in_use = 1; |
1805 | hp->info |= SG_INFO_DIRECT_IO; | 1808 | hp->info |= SG_INFO_DIRECT_IO; |