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
| ||
|
Date: Tue, 25 Aug 2020 12:20:48 +0200 From: Jean-Philippe Brucker <jean-philippe@...aro.org> To: Lu Baolu <baolu.lu@...ux.intel.com> Cc: Jacob Pan <jacob.pan.linux@...il.com>, iommu@...ts.linux-foundation.org, LKML <linux-kernel@...r.kernel.org>, Jean-Philippe Brucker <jean-philippe@...aro.com>, Joerg Roedel <joro@...tes.org>, David Woodhouse <dwmw2@...radead.org>, Yi Liu <yi.l.liu@...el.com>, "Tian, Kevin" <kevin.tian@...el.com>, Raj Ashok <ashok.raj@...el.com>, Eric Auger <eric.auger@...hat.com>, Wu Hao <hao.wu@...el.com> Subject: Re: [PATCH v2 4/9] iommu/ioasid: Add reference couting functions On Mon, Aug 24, 2020 at 10:26:55AM +0800, Lu Baolu wrote: > Hi Jacob, > > On 8/22/20 12:35 PM, Jacob Pan wrote: > > There can be multiple users of an IOASID, each user could have hardware > > contexts associated with the IOASID. In order to align lifecycles, > > reference counting is introduced in this patch. It is expected that when > > an IOASID is being freed, each user will drop a reference only after its > > context is cleared. > > > > Signed-off-by: Jacob Pan <jacob.jun.pan@...ux.intel.com> [...] > > +/** > > * ioasid_find - Find IOASID data > > * @set: the IOASID set > > * @ioasid: the IOASID to find > > Do you need to increase the refcount of the found ioasid and ask the > caller to drop it after use? Otherwise, the ioasid might be freed > elsewhere. ioasid_find() takes a getter function as parameter, which ensures that the returned data is valid. It fetches the IOASID data under rcu_read_lock() and calls the getter on the private data (for example mmget_not_zero() for bare-metal SVA). Given that, I don't think returning with a reference to the IOASID is necessary. The IOASID may be freed once ioasid_find() returns but not the returned data. Thanks, Jean
Powered by blists - more mailing lists