vdpa: Read device configuration only if FEATURES_OK
authorEli Cohen <elic@nvidia.com>
Wed, 5 Jan 2022 11:46:36 +0000 (13:46 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 14 Jan 2022 23:50:53 +0000 (18:50 -0500)
commit30ef7a8ac8a07046b9ac9206d3a732a9f76b2e60
treed352b3baea263b80673b06e56344aac1c6d9dfda
parent73bc0dbb591baea322a7319c735e5f6c7dba9cfb
vdpa: Read device configuration only if FEATURES_OK

Avoid reading device configuration during feature negotiation. Read
device status and verify that VIRTIO_CONFIG_S_FEATURES_OK is set.

Protect the entire operation, including configuration read with cf_mutex
to ensure integrity of the results.

Signed-off-by: Eli Cohen <elic@nvidia.com>
Link: https://lore.kernel.org/r/20220105114646.577224-5-elic@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
drivers/vdpa/vdpa.c