Unverified Commit aeb88973 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3009 vhost-vdpa: allow set feature VHOST_F_LOG_ALL when been negotiated.

parents fc29b47d 9b067b03
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -425,16 +425,19 @@ static long vhost_vdpa_set_features(struct vhost_vdpa *v, u64 __user *featurep)
	u64 features;
	int i;

	if (copy_from_user(&features, featurep, sizeof(features)))
		return -EFAULT;

	actual_features = ops->get_driver_features(vdpa);

	/*
	 * It's not allowed to change the features after they have
	 * been negotiated.
	 * been negotiated. But log start/end is allowed.
	 */
	if (ops->get_status(vdpa) & VIRTIO_CONFIG_S_FEATURES_OK)
	if ((ops->get_status(vdpa) & VIRTIO_CONFIG_S_FEATURES_OK) &&
	    (features & ~(BIT_ULL(VHOST_F_LOG_ALL))) != actual_features)
		return -EBUSY;

	if (copy_from_user(&features, featurep, sizeof(features)))
		return -EFAULT;

	if (vdpa_set_features(vdpa, features))
		return -EINVAL;