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: Wed, 23 Dec 2020 17:25:27 +0900 From: Tomasz Figa <tfiga@...omium.org> To: Yong Wu <yong.wu@...iatek.com> Cc: Joerg Roedel <joro@...tes.org>, Matthias Brugger <matthias.bgg@...il.com>, Rob Herring <robh+dt@...nel.org>, Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>, youlin.pei@...iatek.com, devicetree@...r.kernel.org, Nicolas Boichat <drinkcat@...omium.org>, srv_heupstream@...iatek.com, chao.hao@...iatek.com, linux-kernel@...r.kernel.org, Evan Green <evgreen@...omium.org>, Tomasz Figa <tfiga@...gle.com>, iommu@...ts.linux-foundation.org, linux-mediatek@...ts.infradead.org, Krzysztof Kozlowski <krzk@...nel.org>, anan.sun@...iatek.com, linux-arm-kernel@...ts.infradead.org Subject: Re: [PATCH v5 15/27] iommu/mediatek: Add fail handle for sysfs_add and device_register On Wed, Dec 09, 2020 at 04:00:50PM +0800, Yong Wu wrote: > Add fail handle for iommu_device_sysfs_add and iommu_device_register. > > Fixes: b16c0170b53c ("iommu/mediatek: Make use of iommu_device_register interface") > Signed-off-by: Yong Wu <yong.wu@...iatek.com> > --- > drivers/iommu/mtk_iommu.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c > index 39478cfbe0f1..09c8c58feb78 100644 > --- a/drivers/iommu/mtk_iommu.c > +++ b/drivers/iommu/mtk_iommu.c > @@ -746,7 +746,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) > > ret = iommu_device_register(&data->iommu); > if (ret) > - return ret; > + goto out_sysfs_remove; > > spin_lock_init(&data->tlb_lock); > list_add_tail(&data->list, &m4ulist); > @@ -754,7 +754,16 @@ static int mtk_iommu_probe(struct platform_device *pdev) > if (!iommu_present(&platform_bus_type)) > bus_set_iommu(&platform_bus_type, &mtk_iommu_ops); > > - return component_master_add_with_match(dev, &mtk_iommu_com_ops, match); > + ret = component_master_add_with_match(dev, &mtk_iommu_com_ops, match); > + if (ret) > + goto out_dev_unreg; > + return ret; > + > +out_dev_unreg: Shouldn't other operations be undone as well? I can see that above bus_set_iommu() is set and an entry is added to m4ulist. > + iommu_device_unregister(&data->iommu); > +out_sysfs_remove: > + iommu_device_sysfs_remove(&data->iommu); > + return ret; > } > > static int mtk_iommu_remove(struct platform_device *pdev) > -- > 2.18.0 > > _______________________________________________ > iommu mailing list > iommu@...ts.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu
Powered by blists - more mailing lists