mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mshv: fix fd leak in mshv_ioctl_create_vtl()
@ 2026-07-08  1:28 Yi Xie
  2026-07-08 13:05 ` Hamza Mahfooz
  2026-07-09 16:05 ` Markus Elfring
  0 siblings, 2 replies; 4+ messages in thread
From: Yi Xie @ 2026-07-08  1:28 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu; +Cc: linux-hyperv, linux-kernel, Yi Xie

put_unused_fd() if anon_inode_getfile() fails.

Signed-off-by: Yi Xie <xieyi@kylinos.cn>
---
 drivers/hv/mshv_vtl_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hv/mshv_vtl_main.c b/drivers/hv/mshv_vtl_main.c
index 0d3d4161974f..897a41b08d02 100644
--- a/drivers/hv/mshv_vtl_main.c
+++ b/drivers/hv/mshv_vtl_main.c
@@ -129,6 +129,7 @@ mshv_ioctl_create_vtl(void __user *user_arg, struct device *module_dev)
 	file = anon_inode_getfile("mshv_vtl", &mshv_vtl_fops,
 				  vtl, O_RDWR);
 	if (IS_ERR(file)) {
+		put_unused_fd(fd);
 		kfree(vtl);
 		return PTR_ERR(file);
 	}
-- 
2.34.1

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

* Re: [PATCH] mshv: fix fd leak in mshv_ioctl_create_vtl()
  2026-07-08  1:28 [PATCH] mshv: fix fd leak in mshv_ioctl_create_vtl() Yi Xie
@ 2026-07-08 13:05 ` Hamza Mahfooz
  2026-07-22 22:20   ` Wei Liu
  2026-07-09 16:05 ` Markus Elfring
  1 sibling, 1 reply; 4+ messages in thread
From: Hamza Mahfooz @ 2026-07-08 13:05 UTC (permalink / raw)
  To: Yi Xie; +Cc: kys, haiyangz, wei.liu, linux-hyperv, linux-kernel

On Wed, Jul 08, 2026 at 09:28:52AM +0800, Yi Xie wrote:
> put_unused_fd() if anon_inode_getfile() fails.
> 
> Signed-off-by: Yi Xie <xieyi@kylinos.cn>

Reviewed-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>

> ---
>  drivers/hv/mshv_vtl_main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hv/mshv_vtl_main.c b/drivers/hv/mshv_vtl_main.c
> index 0d3d4161974f..897a41b08d02 100644
> --- a/drivers/hv/mshv_vtl_main.c
> +++ b/drivers/hv/mshv_vtl_main.c
> @@ -129,6 +129,7 @@ mshv_ioctl_create_vtl(void __user *user_arg, struct device *module_dev)
>  	file = anon_inode_getfile("mshv_vtl", &mshv_vtl_fops,
>  				  vtl, O_RDWR);
>  	if (IS_ERR(file)) {
> +		put_unused_fd(fd);
>  		kfree(vtl);
>  		return PTR_ERR(file);
>  	}
> -- 
> 2.34.1

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

* Re: [PATCH] mshv: fix fd leak in mshv_ioctl_create_vtl()
  2026-07-08  1:28 [PATCH] mshv: fix fd leak in mshv_ioctl_create_vtl() Yi Xie
  2026-07-08 13:05 ` Hamza Mahfooz
@ 2026-07-09 16:05 ` Markus Elfring
  1 sibling, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2026-07-09 16:05 UTC (permalink / raw)
  To: Yi Xie, linux-hyperv, Haiyang Zhang, Hamza Mahfooz,
	K. Y. Srinivasan, Wei Liu
  Cc: LKML

> put_unused_fd() if anon_inode_getfile() fails.

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-rc2#n145
* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/stable-kernel-rules.rst?h=v7.2-rc2#n34



* Would you like to complete the exception handling by using another goto chain?

* How do you think about to increase the application of scope-based resource management?


Regards,
Markus

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

* Re: [PATCH] mshv: fix fd leak in mshv_ioctl_create_vtl()
  2026-07-08 13:05 ` Hamza Mahfooz
@ 2026-07-22 22:20   ` Wei Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2026-07-22 22:20 UTC (permalink / raw)
  To: Hamza Mahfooz; +Cc: Yi Xie, kys, haiyangz, wei.liu, linux-hyperv, linux-kernel

On Wed, Jul 08, 2026 at 09:05:16AM -0400, Hamza Mahfooz wrote:
> On Wed, Jul 08, 2026 at 09:28:52AM +0800, Yi Xie wrote:
> > put_unused_fd() if anon_inode_getfile() fails.
> > 
> > Signed-off-by: Yi Xie <xieyi@kylinos.cn>
> 
> Reviewed-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>

Applied to hyperv-fixes. Thanks.

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

end of thread, other threads:[~2026-07-22 22:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-08  1:28 [PATCH] mshv: fix fd leak in mshv_ioctl_create_vtl() Yi Xie
2026-07-08 13:05 ` Hamza Mahfooz
2026-07-22 22:20   ` Wei Liu
2026-07-09 16:05 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®