Commit 122fc708 authored by Eli Cohen's avatar Eli Cohen Committed by Pengyuan Zhao
Browse files

vdpa: Protect vdpa reset with cf_mutex

mainline inclusion
from mainline-v5.17-rc1
commit 680ab9d6
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=680ab9d69a04cfd9f3f5fedaacbc1974b2959121



----------------------------------------------------------------------

Call reset using the wrapper function vdpa_reset() to make sure the
operation is serialized with cf_mutex.

This comes to protect from the following possible scenario:

vhost_vdpa_set_status() could call the reset op. Since the call is not
protected by cf_mutex, a netlink thread calling vdpa_dev_config_fill
could get passed the VIRTIO_CONFIG_S_FEATURES_OK check in
vdpa_dev_config_fill() and end up reporting wrong features.

Fixes: 5f6e85953d8f ("vdpa: Read device configuration only if FEATURES_OK")
Signed-off-by: default avatarEli Cohen <elic@nvidia.com>
Link: https://lore.kernel.org/r/20220111183400.38418-3-elic@nvidia.com


Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarSi-Wei <Liu&lt;si-wei.liu@oracle.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarPengyuan Zhao <zhaopengyuan@hisilicon.com>
parent 8b230111
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment