dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
  • * [PATCH 4.19 185/276] drm/pl111: fix possible object reference leak
           [not found] <20190530030523.133519668@linuxfoundation.org>
           [not found] ` <20190530030523.133519668-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
    @ 2019-05-30  3:05 ` Greg Kroah-Hartman
      1 sibling, 0 replies; 2+ messages in thread
    From: Greg Kroah-Hartman @ 2019-05-30  3:05 UTC (permalink / raw)
      To: linux-kernel
      Cc: Sasha Levin, David Airlie, Greg Kroah-Hartman,
    	"open list:DRM DRIVERS", stable, Wen Yang
    
    [ Upstream commit bc29d3a69d4c1bd1a103e8b3c1ed81b807c1870b ]
    
    The call to of_find_matching_node_and_match 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/pl111/pl111_versatile.c:333:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
    drivers/gpu/drm/pl111/pl111_versatile.c:340:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
    drivers/gpu/drm/pl111/pl111_versatile.c:346:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
    drivers/gpu/drm/pl111/pl111_versatile.c:354:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
    drivers/gpu/drm/pl111/pl111_versatile.c:395:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
    drivers/gpu/drm/pl111/pl111_versatile.c:402:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
    
    Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
    Cc: Eric Anholt <eric@anholt.net> (supporter:DRM DRIVER FOR ARM PL111 CLCD)
    Cc: David Airlie <airlied@linux.ie> (maintainer:DRM DRIVERS)
    Cc: Daniel Vetter <daniel@ffwll.ch> (maintainer:DRM DRIVERS)
    Cc: dri-devel@lists.freedesktop.org (open list:DRM DRIVERS)
    Cc: linux-kernel@vger.kernel.org (open list)
    Signed-off-by: Eric Anholt <eric@anholt.net>
    Link: https://patchwork.freedesktop.org/patch/msgid/1554307455-40361-6-git-send-email-wen.yang99@zte.com.cn
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
     drivers/gpu/drm/pl111/pl111_versatile.c | 4 ++++
     1 file changed, 4 insertions(+)
    
    diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c
    index b9baefdba38a1..1c318ad32a8cd 100644
    --- a/drivers/gpu/drm/pl111/pl111_versatile.c
    +++ b/drivers/gpu/drm/pl111/pl111_versatile.c
    @@ -330,6 +330,7 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv)
     		ret = vexpress_muxfpga_init();
     		if (ret) {
     			dev_err(dev, "unable to initialize muxfpga driver\n");
    +			of_node_put(np);
     			return ret;
     		}
     
    @@ -337,17 +338,20 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv)
     		pdev = of_find_device_by_node(np);
     		if (!pdev) {
     			dev_err(dev, "can't find the sysreg device, deferring\n");
    +			of_node_put(np);
     			return -EPROBE_DEFER;
     		}
     		map = dev_get_drvdata(&pdev->dev);
     		if (!map) {
     			dev_err(dev, "sysreg has not yet probed\n");
     			platform_device_put(pdev);
    +			of_node_put(np);
     			return -EPROBE_DEFER;
     		}
     	} else {
     		map = syscon_node_to_regmap(np);
     	}
    +	of_node_put(np);
     
     	if (IS_ERR(map)) {
     		dev_err(dev, "no Versatile syscon regmap\n");
    -- 
    2.20.1
    
    
    
    _______________________________________________
    dri-devel mailing list
    dri-devel@lists.freedesktop.org
    https://lists.freedesktop.org/mailman/listinfo/dri-devel
    
    ^ permalink raw reply related	[flat|nested] 2+ messages in thread

  • end of thread, other threads:[~2019-05-30  3:17 UTC | newest]
    
    Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <20190530030523.133519668@linuxfoundation.org>
         [not found] ` <20190530030523.133519668-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
    2019-05-30  3:04   ` [PATCH 4.19 140/276] drm/msm: a5xx: fix possible object reference leak Greg Kroah-Hartman
    2019-05-30  3:05 ` [PATCH 4.19 185/276] drm/pl111: " Greg Kroah-Hartman
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox