virtio_pci: modify ENOENT to EINVAL
authorAngus Chen <angus.chen@jaguarmicro.com>
Tue, 1 Nov 2022 11:16:54 +0000 (19:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jan 2023 06:22:41 +0000 (07:22 +0100)
commit8e1eb926a093f98d18c67e3b1f04a003651f305a
tree3100670fa2cca3e3cbf22a07155909fe580e81e0
parent64a6f3689d0df2d7e19e478f7c80847baccdfa7a
virtio_pci: modify ENOENT to EINVAL

[ Upstream commit b66ead2d0ecac00c3a06a6218af5411cb5fcb5d5 ]

Virtio_crypto use max_data_queues+1 to setup vqs,
we use vp_modern_get_num_queues to protect the vq range in setup_vq.
We could enter index >= vp_modern_get_num_queues(mdev) in setup_vq
if common->num_queues is not set well,and it return -ENOENT.
It is better to use -EINVAL instead.

Signed-off-by: Angus Chen <angus.chen@jaguarmicro.com>
Message-Id: <20221101111655.1947-1-angus.chen@jaguarmicro.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/virtio/virtio_pci_modern.c