Re: [PATCH V4 4/9] mshv: Add ioctl support for MSHV-VFIO bridge device
Jacob Pan <[email protected]> Fri, 24 Jul 2026 10:20:29 -0700
| Newsgroups | org.kernel.vger.linux-arch,dev.linux.lists.iommu,org.kernel.vger.linux-hyperv,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci |
|---|---|
| Organization | LSG |
| Message-ID | <[email protected]> |
Hi Mukesh, On Fri, 17 Jul 2026 19:19:44 -0700 Mukesh R <[email protected]> wrote: > + hlist_add_head(&mshv_dev->device_ptnode, > &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() */ + In failure, user never gets the fd, so it never close it. We are leaking fd until process exit, right? Maybe we should do anon_inode_getfile(...) and do fd_install() only if copy_to_user succeeds. Thanks, Jacob