diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index ef752b248c4d5ef7842589299d75a2297ec8178e..d4549092400ce3328d29df047238b0a057f182d2 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -729,6 +729,8 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, return k; /* probably out of space --> ENOMEM */ } if (sdp->detached) { + if (srp->bio) + blk_end_request_all(srp->rq, -EIO); sg_finish_rem_req(srp); return -ENODEV; }