summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/scsi/sg.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/scsi/sg.c')
-rw-r--r--kernel/drivers/scsi/sg.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/drivers/scsi/sg.c b/kernel/drivers/scsi/sg.c
index 9d7b7db75..5e8206744 100644
--- a/kernel/drivers/scsi/sg.c
+++ b/kernel/drivers/scsi/sg.c
@@ -787,8 +787,14 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
return k; /* probably out of space --> ENOMEM */
}
if (atomic_read(&sdp->detaching)) {
- if (srp->bio)
+ if (srp->bio) {
+ if (srp->rq->cmd != srp->rq->__cmd)
+ kfree(srp->rq->cmd);
+
blk_end_request_all(srp->rq, -EIO);
+ srp->rq = NULL;
+ }
+
sg_finish_rem_req(srp);
return -ENODEV;
}
@@ -1255,7 +1261,7 @@ sg_mmap(struct file *filp, struct vm_area_struct *vma)
}
sfp->mmap_called = 1;
- vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+ vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
vma->vm_private_data = sfp;
vma->vm_ops = &sg_mmap_vm_ops;
return 0;