Re: [PATCH v2] iommu/mediatek: fix NULL pointer dereference when printing dev_name

2022-04-26 Thread Miles Chen via iommu
Hi Yong, >On Mon, 2022-04-25 at 11:03 +0100, Robin Murphy wrote: >> On 2022-04-25 09:24, Miles Chen via iommu wrote: >> > When larbdev is NULL (in the case I hit, the node is incorrectly >> > set >> > iommus = < NUM>), it will cause device_link_add() fail and >> >> Until the MT8195 infra MMU

Re: [PATCH v2] iommu/mediatek: fix NULL pointer dereference when printing dev_name

2022-04-26 Thread Miles Chen via iommu
hi Robin, >> -link = device_link_add(dev, larbdev, >> - DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS); >> -if (!link) >> -dev_err(dev, "Unable to link %s\n", dev_name(larbdev)); >> +if (larbdev) { > >Until the MT8195 infra MMU support lands, is there

Re: [PATCH v2] iommu/mediatek: fix NULL pointer dereference when printing dev_name

2022-04-25 Thread Yong Wu via iommu
On Mon, 2022-04-25 at 11:03 +0100, Robin Murphy wrote: > On 2022-04-25 09:24, Miles Chen via iommu wrote: > > When larbdev is NULL (in the case I hit, the node is incorrectly > > set > > iommus = < NUM>), it will cause device_link_add() fail and > > kernel crashes when we try to print

Re: [PATCH v2] iommu/mediatek: fix NULL pointer dereference when printing dev_name

2022-04-25 Thread Robin Murphy
On 2022-04-25 09:24, Miles Chen via iommu wrote: When larbdev is NULL (in the case I hit, the node is incorrectly set iommus = < NUM>), it will cause device_link_add() fail and kernel crashes when we try to print dev_name(larbdev). Fix it by adding a NULL pointer check before

[PATCH v2] iommu/mediatek: fix NULL pointer dereference when printing dev_name

2022-04-25 Thread Miles Chen via iommu
When larbdev is NULL (in the case I hit, the node is incorrectly set iommus = < NUM>), it will cause device_link_add() fail and kernel crashes when we try to print dev_name(larbdev). Fix it by adding a NULL pointer check before device_link_add/device_link_remove. It should work for normal