diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2021-10-15 08:40:52 -0300 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2021-10-15 13:58:20 -0600 |
commit | 325a31c920309d2225311573a05c2f4dd402b2ed (patch) | |
tree | 907abc48d414c4f0b1ab4cef209b417bfce05a72 /COPYING | |
parent | 1ceabade1df78c420e30efd4d39a48ceb46487bc (diff) | |
download | linux-325a31c920309d2225311573a05c2f4dd402b2ed.tar.bz2 |
vfio: Don't leak a group reference if the group already exists
If vfio_create_group() searches the group list and returns an already
existing group it does not put back the iommu_group reference that the
caller passed in.
Change the semantic of vfio_create_group() to not move the reference in
from the caller, but instead obtain a new reference inside and leave the
caller's reference alone. The two callers must now call iommu_group_put().
This is an unlikely race as the only caller that could hit it has already
searched the group list before attempting to create the group.
Fixes: cba3345cc494 ("vfio: VFIO core")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/3-v3-2fdfe4ca2cc6+18c-vfio_group_cdev_jgg@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions