提交 5f638e5a 编写于 作者: X Xie Yongji 提交者: Martin K. Petersen

scsi: virtio_scsi: Add validation for residual bytes from response

This ensures that the residual bytes in response (might come from an
untrusted device) will not exceed the data buffer length.

Link: https://lore.kernel.org/r/20210615105218.214-1-xieyongji@bytedance.comAcked-by: NJason Wang <jasowang@redhat.com>
Signed-off-by: NXie Yongji <xieyongji@bytedance.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 7df47cdf
......@@ -97,7 +97,7 @@ static inline struct Scsi_Host *virtio_scsi_host(struct virtio_device *vdev)
static void virtscsi_compute_resid(struct scsi_cmnd *sc, u32 resid)
{
if (resid)
scsi_set_resid(sc, resid);
scsi_set_resid(sc, min(resid, scsi_bufflen(sc)));
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册