From: Alex Williamson <alex.williamson@redhat.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Anthony DeRossi <ajderossi@gmail.com>,
kvm@vger.kernel.org, cohuck@redhat.com, kevin.tian@intel.com,
abhsahu@nvidia.com, yishaih@nvidia.com
Subject: Re: [PATCH v4 1/3] vfio: Fix container device registration life cycle
Date: Tue, 8 Nov 2022 17:58:38 -0700 [thread overview]
Message-ID: <20221108175838.0763c7d6.alex.williamson@redhat.com> (raw)
In-Reply-To: <Y2r5n+hVkjpMon3q@ziepe.ca>
On Tue, 8 Nov 2022 20:51:43 -0400
Jason Gunthorpe <jgg@ziepe.ca> wrote:
> On Fri, Nov 04, 2022 at 02:59:15PM -0600, Alex Williamson wrote:
> > On Fri, 4 Nov 2022 12:57:25 -0700
> > Anthony DeRossi <ajderossi@gmail.com> wrote:
> >
> > > In vfio_device_open(), vfio_container_device_register() is always called
> > > when open_count == 1. On error, vfio_device_container_unregister() is
> > > only called when open_count == 1 and close_device is set. This leaks a
> > > registration for devices without a close_device implementation.
> > >
> > > In vfio_device_fops_release(), vfio_device_container_unregister() is
> > > called unconditionally. This can cause a device to be unregistered
> > > multiple times.
> > >
> > > Treating container device registration/unregistration uniformly (always
> > > when open_count == 1) fixes both issues.
> >
> > Good catch, I see that Jason does subtly fix this in "vfio: Move
> > vfio_device driver open/close code to a function", but I'd rather see
> > it more overtly fixed in a discrete patch like this. All "real"
> > drivers provide a close_device callback, but mdpy and mtty do not.
>
> Given it only impacts the samples maybe I should just stick it in the
> iommufd series before that patch?
The series in general though fixes a regression. Is there any reason
we shouldn't try to push it into 6.1? Thanks,
Alex
next prev parent reply other threads:[~2022-11-09 0:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 19:57 [PATCH v4 0/3] vfio/pci: Check the device set open_count on reset Anthony DeRossi
2022-11-04 19:57 ` [PATCH v4 1/3] vfio: Fix container device registration life cycle Anthony DeRossi
2022-11-04 20:59 ` Alex Williamson
2022-11-09 0:51 ` Jason Gunthorpe
2022-11-09 0:58 ` Alex Williamson [this message]
2022-11-09 1:00 ` Jason Gunthorpe
2022-11-04 19:57 ` [PATCH v4 2/3] vfio: Add an open counter to vfio_device_set Anthony DeRossi
2022-11-04 20:59 ` Alex Williamson
2022-11-05 22:56 ` Anthony DeRossi
2022-11-04 19:57 ` [PATCH v4 3/3] vfio/pci: Check the device set open_count on reset Anthony DeRossi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221108175838.0763c7d6.alex.williamson@redhat.com \
--to=alex.williamson@redhat.com \
--cc=abhsahu@nvidia.com \
--cc=ajderossi@gmail.com \
--cc=cohuck@redhat.com \
--cc=jgg@ziepe.ca \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=yishaih@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).