提交 caf19d38 编写于 作者: F FUJITA Tomonori 提交者: James Bottomley

[SCSI] sg: fix bio leak with a detached device

After blk_rq_map_user is successful, if we find that a device is
unavailable (was detached), we must call blk_end_request_all to free
bio(s) before blk_rq_unmap_user and blk_put_request.
Reported-by: N"Dailey, Nate" <Nate.Dailey@stratus.com>
Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tested-by: N"Dailey, Nate" <Nate.Dailey@stratus.com>
Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
上级 240778e8
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册