lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YoXoL2tt06sEz9Rd@infradead.org>
Date:   Wed, 18 May 2022 23:48:15 -0700
From:   "hch@...radead.org" <hch@...radead.org>
To:     "Tian, Kevin" <kevin.tian@...el.com>
Cc:     Matthew Rosato <mjrosato@...ux.ibm.com>,
        "jgg@...dia.com" <jgg@...dia.com>,
        "alex.williamson@...hat.com" <alex.williamson@...hat.com>,
        "jjherne@...ux.ibm.com" <jjherne@...ux.ibm.com>,
        "akrowiak@...ux.ibm.com" <akrowiak@...ux.ibm.com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "hch@...radead.org" <hch@...radead.org>,
        "linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>,
        "intel-gfx@...ts.freedesktop.org" <intel-gfx@...ts.freedesktop.org>,
        "cohuck@...hat.com" <cohuck@...hat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "zhenyuw@...ux.intel.com" <zhenyuw@...ux.intel.com>,
        "pasic@...ux.ibm.com" <pasic@...ux.ibm.com>,
        "borntraeger@...ux.ibm.com" <borntraeger@...ux.ibm.com>,
        "intel-gvt-dev@...ts.freedesktop.org" 
        <intel-gvt-dev@...ts.freedesktop.org>,
        "Wang, Zhi A" <zhi.a.wang@...el.com>
Subject: Re: [PATCH v2 1/1] vfio: remove VFIO_GROUP_NOTIFY_SET_KVM

On Thu, May 19, 2022 at 06:43:06AM +0000, Tian, Kevin wrote:
> > This fixes a user-triggerable oops in GVT.
> 
> No changelog.

??

the cover latter clearly states what has changed since v1, and this
patch has a good commit log.  This is exactly how it is supposed to
be done.

> 
> > 
> > Signed-off-by: Jason Gunthorpe <jgg@...dia.com>
> > Signed-off-by: Matthew Rosato <mjrosato@...ux.ibm.com>
> 
> Not sure whether Christoph wants a s-o-b here when he wrote
> the snippet to remove the release work of gvt...

That's just tivial code removal, so no.

> 
> > @@ -1083,11 +1083,22 @@ static struct file *vfio_device_open(struct
> > vfio_device *device)
> > 
> >  	mutex_lock(&device->dev_set->lock);
> >  	device->open_count++;
> > +	down_read(&device->group->group_rwsem);
> > +	if (device->open_count == 1 && device->group->kvm) {
> > +		/*
> > +		 * Here we pass the KVM pointer with the group under the
> > read
> > +		 * lock.  If the device driver will use it, it must obtain a
> > +		 * reference and release it during close_device.
> > +		 */
> > +		device->kvm = device->group->kvm;
> > +	}
> > +
> >  	if (device->open_count == 1 && device->ops->open_device) {
> 
> Merge the two branches so both are under if (device->open_count == 1) {}
> (and group_rwsem can be also moved inside)

Yeah.  And we don't really need the device->group->kvm check, as
it would otherwise assign NULL which is perfectly fine.

But otherwise this also looks good to me:

Reviewed-by: Christoph Hellwig <hch@....de>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ