mshv_vtl: fix fd leak in mshv_ioctl_create_vtl()

put_unused_fd() if anon_inode_getfile() fails.

Fixes: 7bfe3b8ea6 ("Drivers: hv: Introduce mshv_vtl driver")
Signed-off-by: Yi Xie <xieyi@kylinos.cn>
Reviewed-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
Yi Xie 2026-07-08 09:28:52 +08:00 committed by Wei Liu
parent b496f042e0
commit ec08dd5b9f

View File

@ -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);
}