Re: [PATCH V4 4/9] mshv: Add ioctl support for MSHV-VFIO bridge device
From: Mukesh R
Date: Fri Jul 24 2026 - 17:30:06 EST
On 7/24/26 10:20, Jacob Pan wrote:
Hi Mukesh,
On Fri, 17 Jul 2026 19:19:44 -0700
Mukesh R <mrathor@xxxxxxxxxxxxxxxxxxx> wrote:
+ hlist_add_head(&mshv_dev->device_ptnode,In failure, user never gets the fd, so it never close it. We are leaking
&partition->pt_devices); +
+ mshv_partition_get(partition);
+ rc = anon_inode_getfd(vfio_ops->device_name,
&mshv_device_fops,
+ mshv_dev, O_RDWR | O_CLOEXEC);
+ if (rc < 0)
+ goto undo_out;
+
+ devargk.fd = rc;
+ if (copy_to_user(uarg, &devargk, sizeof(devargk)))
+ return -EFAULT; /* cleanup in
mshv_device_fop_release() */ +
fd until process exit, right?
Maybe we should do anon_inode_getfile(...) and do fd_install() only if
copy_to_user succeeds.
Thanks,
Jacob
Hey,
right, but efault should result in sigsegv and immediate exit... unless
some rogue vmm is trapping it and doing something malicous in which case
all it can do is fill up only its own file descriptor table.
given that the above is same as kvm_ioctl_create_device(), i think it
is ok to leave as is. if you think both need changing, lmk.
Thanks,
-Mukesh