[PATCH] vdpa: ifcvf: Put device on unsupported feature error

Xiong Weimin posted 1 patch 1 month, 4 weeks ago
There is a newer version of this series
drivers/vdpa/ifcvf/ifcvf_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] vdpa: ifcvf: Put device on unsupported feature error
Posted by Xiong Weimin 1 month, 4 weeks ago
Route unsupported provisioned features through the common error path after
vdpa_alloc_device() so the allocated device and adapter pointer are
released consistently.

Signed-off-by: Xiong Weimin <xiongweimin@kylinos.cn>
---
 drivers/vdpa/ifcvf/ifcvf_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
index ab6d6ab3b..3cd2c35db 100644
--- a/drivers/vdpa/ifcvf/ifcvf_main.c
+++ b/drivers/vdpa/ifcvf/ifcvf_main.c
@@ -724,7 +724,8 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
 		if (config->device_features & ~device_features) {
 			IFCVF_ERR(pdev, "The provisioned features 0x%llx are not supported by this device with features 0x%llx\n",
 				  config->device_features, device_features);
-			return -EINVAL;
+			ret = -EINVAL;
+			goto err;
 		}
 		device_features &= config->device_features;
 	}
@@ -748,6 +749,7 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
 	return 0;
 
 err:
+	ifcvf_mgmt_dev->adapter = NULL;
 	put_device(&adapter->vdpa.dev);
 	return ret;
 }
-- 
2.43.0
Re: [PATCH] vdpa: ifcvf: Put device on unsupported feature error
Posted by Michael S. Tsirkin 1 month, 4 weeks ago
On Tue, Aug 04, 2026 at 05:26:26PM +0800, Xiong Weimin wrote:
> Route unsupported provisioned features through the common error path after
> vdpa_alloc_device() so the allocated device and adapter pointer are
> released consistently.
> 
> Signed-off-by: Xiong Weimin <xiongweimin@kylinos.cn>


I have no idea what this means. This is not how a commit log should
look. An example template:

Currently .... This is a problem because ... We can not do .... because
... To address .... And then ....



> ---
>  drivers/vdpa/ifcvf/ifcvf_main.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> index ab6d6ab3b..3cd2c35db 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -724,7 +724,8 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
>  		if (config->device_features & ~device_features) {
>  			IFCVF_ERR(pdev, "The provisioned features 0x%llx are not supported by this device with features 0x%llx\n",
>  				  config->device_features, device_features);
> -			return -EINVAL;
> +			ret = -EINVAL;
> +			goto err;
>  		}
>  		device_features &= config->device_features;
>  	}
> @@ -748,6 +749,7 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
>  	return 0;
>  
>  err:
> +	ifcvf_mgmt_dev->adapter = NULL;
>  	put_device(&adapter->vdpa.dev);
>  	return ret;
>  }
> -- 
> 2.43.0
Re: [PATCH] vdpa: ifcvf: Put device on unsupported feature error
Posted by Markus Elfring 1 month, 4 weeks ago
> Route unsupported provisioned features through the common error path after
> vdpa_alloc_device() so the allocated device and adapter pointer are
> released consistently.

How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?

See also:
* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.2-rc6#n145
* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/stable-kernel-rules.rst?h=v7.2-rc6#n34


Regards,
Markus
Re: [PATCH] vdpa: ifcvf: Put device on unsupported feature error
Posted by Xiong Weimin 1 month, 4 weeks ago
On Tue, Aug 04, 2026 at 06:32:04PM +0200, Markus Elfring wrote:
> How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?

Yes, this is a bug fix for the feature provisioning error path, so adding
the tags makes sense.

I will send a v2 with:

Fixes: 46fc0917bbab ("vDPA/ifcvf: implement features provisioning")
Cc: stable@vger.kernel.org # v6.3+

Thanks,
Xiong