mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
vhost-scsi: Fix check for inline_sg_cnt exceeding preallocated limit
[ Upstream commit400cad513c
] The condition comparing ret to VHOST_SCSI_PREALLOC_SGLS was incorrect, as ret holds the result of kstrtouint() (typically 0 on success), not the parsed value. Update the check to use cnt, which contains the actual user-provided value. prevents silently accepting values exceeding the maximum inline_sg_cnt. Fixes:bca939d5bc
("vhost-scsi: Dynamically allocate scatterlists") Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com> Reviewed-by: Mike Christie <michael.christie@oracle.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20250628183405.3979538-1-alok.a.tiwari@oracle.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
648a5d7928
commit
b028d38c6c
|
@ -71,7 +71,7 @@ static int vhost_scsi_set_inline_sg_cnt(const char *buf,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (ret > VHOST_SCSI_PREALLOC_SGLS) {
|
||||
if (cnt > VHOST_SCSI_PREALLOC_SGLS) {
|
||||
pr_err("Max inline_sg_cnt is %u\n", VHOST_SCSI_PREALLOC_SGLS);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user