linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vdpa: ifcvf: Put device on unsupported feature error
@ 2026-08-04  9:26 Xiong Weimin
  2026-08-04 16:32 ` Markus Elfring
  2026-08-04 21:18 ` Michael S. Tsirkin
  0 siblings, 2 replies; 4+ messages in thread
From: Xiong Weimin @ 2026-08-04  9:26 UTC (permalink / raw)
  To: Zhu Lingshan
  Cc: Michael S . Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
	virtualization, linux-kernel, Xiong Weimin

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] vdpa: ifcvf: Put device on unsupported feature error
  2026-08-04  9:26 [PATCH] vdpa: ifcvf: Put device on unsupported feature error Xiong Weimin
@ 2026-08-04 16:32 ` Markus Elfring
  2026-08-05  1:39   ` Xiong Weimin
  2026-08-04 21:18 ` Michael S. Tsirkin
  1 sibling, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2026-08-04 16:32 UTC (permalink / raw)
  To: Xiong Weimin, virtualization, Zhu Lingshan
  Cc: LKML, Eugenio Pérez, Jason Wang, Michael S. Tsirkin,
	Xuan Zhuo

> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vdpa: ifcvf: Put device on unsupported feature error
  2026-08-04  9:26 [PATCH] vdpa: ifcvf: Put device on unsupported feature error Xiong Weimin
  2026-08-04 16:32 ` Markus Elfring
@ 2026-08-04 21:18 ` Michael S. Tsirkin
  1 sibling, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2026-08-04 21:18 UTC (permalink / raw)
  To: Xiong Weimin
  Cc: Zhu Lingshan, Jason Wang, Xuan Zhuo, Eugenio Pérez,
	virtualization, linux-kernel

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vdpa: ifcvf: Put device on unsupported feature error
  2026-08-04 16:32 ` Markus Elfring
@ 2026-08-05  1:39   ` Xiong Weimin
  0 siblings, 0 replies; 4+ messages in thread
From: Xiong Weimin @ 2026-08-05  1:39 UTC (permalink / raw)
  To: Markus Elfring
  Cc: virtualization, Zhu Lingshan, LKML, Eugenio Pérez,
	Jason Wang, Michael S. Tsirkin, Xuan Zhuo

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-05  1:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04  9:26 [PATCH] vdpa: ifcvf: Put device on unsupported feature error Xiong Weimin
2026-08-04 16:32 ` Markus Elfring
2026-08-05  1:39   ` Xiong Weimin
2026-08-04 21:18 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).