* [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device @ 2022-01-07 8:04 ` Miaoqian Lin 0 siblings, 0 replies; 12+ messages in thread From: Miaoqian Lin @ 2022-01-07 8:04 UTC (permalink / raw) Cc: linmq006, Joerg Roedel, Will Deacon, Suman Anna, iommu, linux-kernel The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add the corresponding 'put_device()' in the error handling paths. Fixes: ede1c2e7d4dc ("iommu/omap: Store iommu_dev pointer in arch_data") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> --- drivers/iommu/omap-iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 91749654fd49..cbc7ca5e890a 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -1684,6 +1684,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev) oiommu = platform_get_drvdata(pdev); if (!oiommu) { of_node_put(np); + put_device(&pdev->dev); kfree(arch_data); return ERR_PTR(-EINVAL); } -- 2.17.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device @ 2022-01-07 8:04 ` Miaoqian Lin 0 siblings, 0 replies; 12+ messages in thread From: Miaoqian Lin @ 2022-01-07 8:04 UTC (permalink / raw) Cc: linmq006, linux-kernel, iommu, Will Deacon The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add the corresponding 'put_device()' in the error handling paths. Fixes: ede1c2e7d4dc ("iommu/omap: Store iommu_dev pointer in arch_data") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> --- drivers/iommu/omap-iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 91749654fd49..cbc7ca5e890a 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -1684,6 +1684,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev) oiommu = platform_get_drvdata(pdev); if (!oiommu) { of_node_put(np); + put_device(&pdev->dev); kfree(arch_data); return ERR_PTR(-EINVAL); } -- 2.17.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device 2022-01-07 8:04 ` Miaoqian Lin @ 2022-01-07 14:42 ` Suman Anna via iommu -1 siblings, 0 replies; 12+ messages in thread From: Suman Anna @ 2022-01-07 14:42 UTC (permalink / raw) To: Miaoqian Lin Cc: Joerg Roedel, Will Deacon, iommu, linux-kernel, Nagalla, Hari Hi Miaoqian, On 1/7/22 2:04 AM, Miaoqian Lin wrote: > The reference taken by 'of_find_device_by_node()' must be released when > not needed anymore. Thanks for catching this. > Add the corresponding 'put_device()' in the error handling paths. Also, need it in the regular path, not just in error handling path. > > Fixes: ede1c2e7d4dc ("iommu/omap: Store iommu_dev pointer in arch_data") > Signed-off-by: Miaoqian Lin <linmq006@gmail.com> > --- > drivers/iommu/omap-iommu.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c > index 91749654fd49..cbc7ca5e890a 100644 > --- a/drivers/iommu/omap-iommu.c > +++ b/drivers/iommu/omap-iommu.c > @@ -1684,6 +1684,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev) > oiommu = platform_get_drvdata(pdev); > if (!oiommu) { > of_node_put(np); > + put_device(&pdev->dev); nit, doesn't matter for functionality, but prefer the put_device before of_node_put(). regards Suman > kfree(arch_data); > return ERR_PTR(-EINVAL); > } > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device @ 2022-01-07 14:42 ` Suman Anna via iommu 0 siblings, 0 replies; 12+ messages in thread From: Suman Anna via iommu @ 2022-01-07 14:42 UTC (permalink / raw) To: Miaoqian Lin; +Cc: Nagalla, Hari, Will Deacon, iommu, linux-kernel Hi Miaoqian, On 1/7/22 2:04 AM, Miaoqian Lin wrote: > The reference taken by 'of_find_device_by_node()' must be released when > not needed anymore. Thanks for catching this. > Add the corresponding 'put_device()' in the error handling paths. Also, need it in the regular path, not just in error handling path. > > Fixes: ede1c2e7d4dc ("iommu/omap: Store iommu_dev pointer in arch_data") > Signed-off-by: Miaoqian Lin <linmq006@gmail.com> > --- > drivers/iommu/omap-iommu.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c > index 91749654fd49..cbc7ca5e890a 100644 > --- a/drivers/iommu/omap-iommu.c > +++ b/drivers/iommu/omap-iommu.c > @@ -1684,6 +1684,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev) > oiommu = platform_get_drvdata(pdev); > if (!oiommu) { > of_node_put(np); > + put_device(&pdev->dev); nit, doesn't matter for functionality, but prefer the put_device before of_node_put(). regards Suman > kfree(arch_data); > return ERR_PTR(-EINVAL); > } > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device 2022-01-07 14:42 ` Suman Anna via iommu @ 2022-01-10 2:43 ` Miaoqian Lin -1 siblings, 0 replies; 12+ messages in thread From: Miaoqian Lin @ 2022-01-10 2:43 UTC (permalink / raw) To: Suman Anna; +Cc: Joerg Roedel, Will Deacon, iommu, linux-kernel, Nagalla, Hari Hi Suman Anna, On Fri, Jan 07, 2022 at 08:42:16AM -0600, Suman Anna wrote: > Hi Miaoqian, > > > > Add the corresponding 'put_device()' in the error handling paths. > > Also, need it in the regular path, not just in error handling path. I think after calling platform_get_drvdata() normally, the reference will be released in other functions, so don't need it in the regular path. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device @ 2022-01-10 2:43 ` Miaoqian Lin 0 siblings, 0 replies; 12+ messages in thread From: Miaoqian Lin @ 2022-01-10 2:43 UTC (permalink / raw) To: Suman Anna; +Cc: Nagalla, Hari, Will Deacon, iommu, linux-kernel Hi Suman Anna, On Fri, Jan 07, 2022 at 08:42:16AM -0600, Suman Anna wrote: > Hi Miaoqian, > > > > Add the corresponding 'put_device()' in the error handling paths. > > Also, need it in the regular path, not just in error handling path. I think after calling platform_get_drvdata() normally, the reference will be released in other functions, so don't need it in the regular path. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device 2022-01-10 2:43 ` Miaoqian Lin @ 2022-01-10 18:43 ` Suman Anna via iommu -1 siblings, 0 replies; 12+ messages in thread From: Suman Anna @ 2022-01-10 18:43 UTC (permalink / raw) To: Miaoqian Lin Cc: Joerg Roedel, Will Deacon, iommu, linux-kernel, Nagalla, Hari Hi Miaoqian, On 1/9/22 8:43 PM, Miaoqian Lin wrote: > Hi Suman Anna, > On Fri, Jan 07, 2022 at 08:42:16AM -0600, Suman Anna wrote: >> Hi Miaoqian, >> >> >>> Add the corresponding 'put_device()' in the error handling paths. >> >> Also, need it in the regular path, not just in error handling path. > I think after calling platform_get_drvdata() normally, the > reference will be released in other functions, so don't need it in the > regular path. > No, it's a local reference and is acquired within omap_iommu_probe_device() and needs to be released within this function. What other function are you referring to here? regards Suman ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device @ 2022-01-10 18:43 ` Suman Anna via iommu 0 siblings, 0 replies; 12+ messages in thread From: Suman Anna via iommu @ 2022-01-10 18:43 UTC (permalink / raw) To: Miaoqian Lin; +Cc: Nagalla, Hari, Will Deacon, iommu, linux-kernel Hi Miaoqian, On 1/9/22 8:43 PM, Miaoqian Lin wrote: > Hi Suman Anna, > On Fri, Jan 07, 2022 at 08:42:16AM -0600, Suman Anna wrote: >> Hi Miaoqian, >> >> >>> Add the corresponding 'put_device()' in the error handling paths. >> >> Also, need it in the regular path, not just in error handling path. > I think after calling platform_get_drvdata() normally, the > reference will be released in other functions, so don't need it in the > regular path. > No, it's a local reference and is acquired within omap_iommu_probe_device() and needs to be released within this function. What other function are you referring to here? regards Suman _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device 2022-01-10 18:43 ` Suman Anna via iommu @ 2022-01-12 11:54 ` Miaoqian Lin -1 siblings, 0 replies; 12+ messages in thread From: Miaoqian Lin @ 2022-01-12 11:54 UTC (permalink / raw) To: Suman Anna; +Cc: Joerg Roedel, Will Deacon, iommu, linux-kernel, Nagalla, Hari Hi Suman, On Mon, Jan 10, 2022 at 12:43:57PM -0600, Suman Anna wrote: > Hi Miaoqian, > > On 1/9/22 8:43 PM, Miaoqian Lin wrote: > > Hi Suman Anna, > > On Fri, Jan 07, 2022 at 08:42:16AM -0600, Suman Anna wrote: > >> Hi Miaoqian, > >> > >> > >>> Add the corresponding 'put_device()' in the error handling paths. > >> > >> Also, need it in the regular path, not just in error handling path. > > I think after calling platform_get_drvdata() normally, the > > reference will be released in other functions, so don't need it in the > > regular path. > > > > No, it's a local reference and is acquired within omap_iommu_probe_device() and > needs to be released within this function. What other function are you referring > to here? > I am referring to the release function of this device, here is omap_iommu_release_device(). But I find omap_iommu_release_device() doesn't handle the reference, and calls kfree(arch_data) directly. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device @ 2022-01-12 11:54 ` Miaoqian Lin 0 siblings, 0 replies; 12+ messages in thread From: Miaoqian Lin @ 2022-01-12 11:54 UTC (permalink / raw) To: Suman Anna; +Cc: Nagalla, Hari, Will Deacon, iommu, linux-kernel Hi Suman, On Mon, Jan 10, 2022 at 12:43:57PM -0600, Suman Anna wrote: > Hi Miaoqian, > > On 1/9/22 8:43 PM, Miaoqian Lin wrote: > > Hi Suman Anna, > > On Fri, Jan 07, 2022 at 08:42:16AM -0600, Suman Anna wrote: > >> Hi Miaoqian, > >> > >> > >>> Add the corresponding 'put_device()' in the error handling paths. > >> > >> Also, need it in the regular path, not just in error handling path. > > I think after calling platform_get_drvdata() normally, the > > reference will be released in other functions, so don't need it in the > > regular path. > > > > No, it's a local reference and is acquired within omap_iommu_probe_device() and > needs to be released within this function. What other function are you referring > to here? > I am referring to the release function of this device, here is omap_iommu_release_device(). But I find omap_iommu_release_device() doesn't handle the reference, and calls kfree(arch_data) directly. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device 2022-01-07 14:42 ` Suman Anna via iommu @ 2022-03-01 6:33 ` Miaoqian Lin -1 siblings, 0 replies; 12+ messages in thread From: Miaoqian Lin @ 2022-03-01 6:33 UTC (permalink / raw) To: Joerg Roedel, Will Deacon, Suman Anna, iommu, linux-kernel; +Cc: linmq006 The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add the corresponding 'put_device()' in the error handling path and the regular path. Fixes: ede1c2e7d4dc ("iommu/omap: Store iommu_dev pointer in arch_data") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> --- changes in v2: - move put_device() before of_node_put(). - add put_device() in the regular path. --- drivers/iommu/omap-iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 91749654fd49..2222b30a0a00 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -1683,6 +1683,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev) oiommu = platform_get_drvdata(pdev); if (!oiommu) { + put_device(&pdev->dev); of_node_put(np); kfree(arch_data); return ERR_PTR(-EINVAL); @@ -1691,6 +1692,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev) tmp->iommu_dev = oiommu; tmp->dev = &pdev->dev; + put_device(&pdev->dev); of_node_put(np); } -- 2.17.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device @ 2022-03-01 6:33 ` Miaoqian Lin 0 siblings, 0 replies; 12+ messages in thread From: Miaoqian Lin @ 2022-03-01 6:33 UTC (permalink / raw) To: Joerg Roedel, Will Deacon, Suman Anna, iommu, linux-kernel; +Cc: linmq006 The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add the corresponding 'put_device()' in the error handling path and the regular path. Fixes: ede1c2e7d4dc ("iommu/omap: Store iommu_dev pointer in arch_data") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> --- changes in v2: - move put_device() before of_node_put(). - add put_device() in the regular path. --- drivers/iommu/omap-iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 91749654fd49..2222b30a0a00 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -1683,6 +1683,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev) oiommu = platform_get_drvdata(pdev); if (!oiommu) { + put_device(&pdev->dev); of_node_put(np); kfree(arch_data); return ERR_PTR(-EINVAL); @@ -1691,6 +1692,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev) tmp->iommu_dev = oiommu; tmp->dev = &pdev->dev; + put_device(&pdev->dev); of_node_put(np); } -- 2.17.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-03-01 6:33 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-01-07 8:04 [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device Miaoqian Lin 2022-01-07 8:04 ` Miaoqian Lin 2022-01-07 14:42 ` Suman Anna 2022-01-07 14:42 ` Suman Anna via iommu 2022-01-10 2:43 ` Miaoqian Lin 2022-01-10 2:43 ` Miaoqian Lin 2022-01-10 18:43 ` Suman Anna 2022-01-10 18:43 ` Suman Anna via iommu 2022-01-12 11:54 ` Miaoqian Lin 2022-01-12 11:54 ` Miaoqian Lin 2022-03-01 6:33 ` [PATCH v2] " Miaoqian Lin 2022-03-01 6:33 ` Miaoqian Lin
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.