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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZB3Xo576l33OH/S/@Asurada-Nvidia>
Date:   Fri, 24 Mar 2023 10:02:27 -0700
From:   Nicolin Chen <nicolinc@...dia.com>
To:     "Tian, Kevin" <kevin.tian@...el.com>
CC:     "jgg@...dia.com" <jgg@...dia.com>,
        "joro@...tes.org" <joro@...tes.org>,
        "will@...nel.org" <will@...nel.org>,
        "robin.murphy@....com" <robin.murphy@....com>,
        "alex.williamson@...hat.com" <alex.williamson@...hat.com>,
        "shuah@...nel.org" <shuah@...nel.org>,
        "Liu, Yi L" <yi.l.liu@...el.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
        "mjrosato@...ux.ibm.com" <mjrosato@...ux.ibm.com>,
        "farman@...ux.ibm.com" <farman@...ux.ibm.com>
Subject: Re: [PATCH v5 2/4] iommufd: Add iommufd_access_replace() API

On Fri, Mar 24, 2023 at 03:02:46AM +0000, Tian, Kevin wrote:
> External email: Use caution opening links or attachments
> 
> 
> > From: Nicolin Chen <nicolinc@...dia.com>
> > Sent: Thursday, March 23, 2023 4:33 PM
> >
> > +int iommufd_access_replace(struct iommufd_access *access, u32 ioas_id)
> > +{
> > +     struct iommufd_ioas *new_ioas;
> > +
> > +     mutex_lock(&access->ioas_lock);
> > +     if (!access->ioas) {
> >               mutex_unlock(&access->ioas_lock);
> > -             iommufd_put_object(obj);
> > -             return rc;
> > +             return -ENOENT;
> > +     }
> > +     if (access->ioas->obj.id == ioas_id) {
> > +             mutex_unlock(&access->ioas_lock);
> > +             return 0;
> >       }
> > -     iommufd_ref_to_users(obj);
> >
> > +     new_ioas = iommufd_access_change_pt(access, ioas_id);
> > +     if (IS_ERR(new_ioas)) {
> > +             mutex_unlock(&access->ioas_lock);
> > +             return PTR_ERR(new_ioas);
> > +     }
> > +     __iommufd_access_detach(access);
> >       access->ioas = new_ioas;
> >       access->ioas_unpin = new_ioas;
> 
> Above three lines can be moved into iommufd_access_change_pt():
> 
>         If (access->ioas)
>                 __iommufd_access_detach(access);
>         access->ioas = new_ioas;
>         access->ioas_unpin = new_ioas;
> 
> Then both attach/replace can end by calling the common function.

OK. Will do that in v6.

Thanks
Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ