]> git.droids-corp.org - dpdk.git/commitdiff
vdpa/ifc: fix vhost message size check
authorAndy Pei <andy.pei@intel.com>
Tue, 21 Jun 2022 13:46:31 +0000 (21:46 +0800)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Fri, 1 Jul 2022 13:49:49 +0000 (15:49 +0200)
For vhost message VHOST_USER_GET_CONFIG, we do not check
payload size in vhost lib, we check payload size in driver
specific ops.
For ifc vdpa driver, we just need to make sure payload size
is not smaller than sizeof(struct virtio_blk_config).

Fixes: 856d03bcdc54 ("vdpa/ifc: add block operations")
Signed-off-by: Andy Pei <andy.pei@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/vdpa/ifc/ifcvf_vdpa.c

index 8bc971cb12434c41e6a0118c18ac59780fe6b55b..ac42de9c795207c321943dbb30a2206b422cb644 100644 (file)
@@ -1400,7 +1400,7 @@ ifcvf_blk_get_config(int vid, uint8_t *config, uint32_t size)
        uint64_t capacity = 0;
        uint8_t *byte;
 
-       if (size != sizeof(struct virtio_blk_config)) {
+       if (size < sizeof(struct virtio_blk_config)) {
                DRV_LOG(ERR, "Invalid len: %u, required: %u",
                        size, (uint32_t)sizeof(struct virtio_blk_config));
                return -1;