From: Jordan Crouse <jcrouse@codeaurora.org> To: Wen Yang <wen.yang99@zte.com.cn> Cc: wang.yi59@zte.com.cn, freedreno@lists.freedesktop.org, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@linux.ie>, linux-arm-msm@vger.kernel.org, Sharat Masetty <smasetty@codeaurora.org>, linux-kernel@vger.kernel.org, Mamta Shukla <mamtashukla555@gmail.com>, dri-devel@lists.freedesktop.org, Sean Paul <sean@poorly.run> Subject: Re: [PATCH 3/7] drm/msm: a5xx: fix possible object reference leak Date: Wed, 10 Apr 2019 10:21:40 -0600 [thread overview] Message-ID: <20190410162140.GA9296@jcrouse1-lnx.qualcomm.com> (raw) In-Reply-To: <1554307455-40361-4-git-send-email-wen.yang99@zte.com.cn> On Thu, Apr 04, 2019 at 12:04:11AM +0800, Wen Yang wrote: > The call to of_get_child_by_name returns a node pointer with refcount > incremented thus it must be explicitly decremented after the last > usage. > > Detected by coccinelle with the following warnings: > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:57:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:66:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:118:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:57:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function. > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:66:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function. > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:118:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function. > > Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> > Cc: Rob Clark <robdclark@gmail.com> > Cc: Sean Paul <sean@poorly.run> > Cc: David Airlie <airlied@linux.ie> > Cc: Daniel Vetter <daniel@ffwll.ch> > Cc: Jordan Crouse <jcrouse@codeaurora.org> > Cc: Mamta Shukla <mamtashukla555@gmail.com> > Cc: Thomas Zimmermann <tzimmermann@suse.de> > Cc: Sharat Masetty <smasetty@codeaurora.org> > Cc: linux-arm-msm@vger.kernel.org > Cc: dri-devel@lists.freedesktop.org > Cc: freedreno@lists.freedesktop.org > Cc: linux-kernel@vger.kernel.org (open list) Sorry for the delay. This looks right to me and possibly appropriate for stable as well. Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org> > --- > drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c > index d5f5e56..270da14 100644 > --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c > +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c > @@ -34,7 +34,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname) > { > struct device *dev = &gpu->pdev->dev; > const struct firmware *fw; > - struct device_node *np; > + struct device_node *np, *mem_np; > struct resource r; > phys_addr_t mem_phys; > ssize_t mem_size; > @@ -48,11 +48,13 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname) > if (!np) > return -ENODEV; > > - np = of_parse_phandle(np, "memory-region", 0); > - if (!np) > + mem_np = of_parse_phandle(np, "memory-region", 0); > + of_node_put(np); > + if (!mem_np) > return -EINVAL; > > - ret = of_address_to_resource(np, 0, &r); > + ret = of_address_to_resource(mem_np, 0, &r); > + of_node_put(mem_np); > if (ret) > return ret; > > -- > 2.9.5 > -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jordan Crouse <jcrouse@codeaurora.org> To: Wen Yang <wen.yang99@zte.com.cn> Cc: linux-kernel@vger.kernel.org, wang.yi59@zte.com.cn, Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>, Mamta Shukla <mamtashukla555@gmail.com>, Thomas Zimmermann <tzimmermann@suse.de>, Sharat Masetty <smasetty@codeaurora.org>, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: Re: [PATCH 3/7] drm/msm: a5xx: fix possible object reference leak Date: Wed, 10 Apr 2019 10:21:40 -0600 [thread overview] Message-ID: <20190410162140.GA9296@jcrouse1-lnx.qualcomm.com> (raw) Message-ID: <20190410162140.xHrzT2LK1YQgQhhdCCoLdQAJCGpG1j9VL91SloShjKE@z> (raw) In-Reply-To: <1554307455-40361-4-git-send-email-wen.yang99@zte.com.cn> On Thu, Apr 04, 2019 at 12:04:11AM +0800, Wen Yang wrote: > The call to of_get_child_by_name returns a node pointer with refcount > incremented thus it must be explicitly decremented after the last > usage. > > Detected by coccinelle with the following warnings: > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:57:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:66:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:118:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:57:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function. > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:66:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function. > drivers/gpu/drm/msm/adreno/a5xx_gpu.c:118:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function. > > Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> > Cc: Rob Clark <robdclark@gmail.com> > Cc: Sean Paul <sean@poorly.run> > Cc: David Airlie <airlied@linux.ie> > Cc: Daniel Vetter <daniel@ffwll.ch> > Cc: Jordan Crouse <jcrouse@codeaurora.org> > Cc: Mamta Shukla <mamtashukla555@gmail.com> > Cc: Thomas Zimmermann <tzimmermann@suse.de> > Cc: Sharat Masetty <smasetty@codeaurora.org> > Cc: linux-arm-msm@vger.kernel.org > Cc: dri-devel@lists.freedesktop.org > Cc: freedreno@lists.freedesktop.org > Cc: linux-kernel@vger.kernel.org (open list) Sorry for the delay. This looks right to me and possibly appropriate for stable as well. Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org> > --- > drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c > index d5f5e56..270da14 100644 > --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c > +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c > @@ -34,7 +34,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname) > { > struct device *dev = &gpu->pdev->dev; > const struct firmware *fw; > - struct device_node *np; > + struct device_node *np, *mem_np; > struct resource r; > phys_addr_t mem_phys; > ssize_t mem_size; > @@ -48,11 +48,13 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname) > if (!np) > return -ENODEV; > > - np = of_parse_phandle(np, "memory-region", 0); > - if (!np) > + mem_np = of_parse_phandle(np, "memory-region", 0); > + of_node_put(np); > + if (!mem_np) > return -EINVAL; > > - ret = of_address_to_resource(np, 0, &r); > + ret = of_address_to_resource(mem_np, 0, &r); > + of_node_put(mem_np); > if (ret) > return ret; > > -- > 2.9.5 > -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2019-04-10 16:21 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-03 16:04 [PATCH 0/7] fix possible object reference leaks in drivers/gpu Wen Yang 2019-04-03 16:04 ` [PATCH 1/7] drm/mediatek: fix possible object reference leak Wen Yang 2019-04-03 16:04 ` Wen Yang 2019-04-09 5:15 ` CK Hu 2019-04-09 5:15 ` CK Hu 2019-04-09 5:15 ` CK Hu 2019-04-03 16:04 ` [PATCH 2/7] drm/meson: " Wen Yang 2019-04-03 16:04 ` Wen Yang 2019-04-03 16:04 ` Wen Yang 2019-04-03 16:04 ` Wen Yang 2019-04-04 20:05 ` Markus Elfring 2019-04-04 20:05 ` Markus Elfring 2019-04-04 20:05 ` Markus Elfring 2019-04-04 20:05 ` Markus Elfring 2019-04-04 20:05 ` Markus Elfring 2019-04-03 16:04 ` [PATCH 3/7] drm/msm: a5xx: " Wen Yang 2019-04-10 16:21 ` Jordan Crouse [this message] 2019-04-10 16:21 ` Jordan Crouse 2019-04-03 16:04 ` [PATCH 4/7] drm/omap: " Wen Yang 2019-04-04 13:25 ` Laurent Pinchart 2019-04-08 1:24 ` wen.yang99 2019-04-04 20:42 ` Markus Elfring 2019-04-04 20:42 ` Markus Elfring 2019-04-03 16:04 ` [PATCH 5/7] drm/pl111: " Wen Yang 2019-04-03 16:04 ` Wen Yang 2019-04-04 19:59 ` Eric Anholt 2019-04-04 19:59 ` Eric Anholt 2019-04-04 21:05 ` Markus Elfring 2019-04-04 21:05 ` Markus Elfring 2019-04-03 16:04 ` [PATCH 6/7] drm: rcar-du: " Wen Yang 2019-04-04 13:35 ` Laurent Pinchart 2019-04-08 1:10 ` 答复: " wen.yang99 2019-04-03 16:04 ` [PATCH 7/7] drm/tegra: " Wen Yang
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190410162140.GA9296@jcrouse1-lnx.qualcomm.com \ --to=jcrouse@codeaurora.org \ --cc=airlied@linux.ie \ --cc=dri-devel@lists.freedesktop.org \ --cc=freedreno@lists.freedesktop.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mamtashukla555@gmail.com \ --cc=sean@poorly.run \ --cc=smasetty@codeaurora.org \ --cc=tzimmermann@suse.de \ --cc=wang.yi59@zte.com.cn \ --cc=wen.yang99@zte.com.cn \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.