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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220419121408.1291270-1-william.xuanziyang@huawei.com>
Date:   Tue, 19 Apr 2022 20:14:08 +0800
From:   Ziyang Xuan <william.xuanziyang@...wei.com>
To:     <maarten.lankhorst@...ux.intel.com>, <mripard@...nel.org>,
        <tzimmermann@...e.de>, <airlied@...ux.ie>, <daniel@...ll.ch>,
        <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] drm: of: fix a potential double put bug

Execute the following coccinelle rule:
$make coccicheck COCCI=scripts/coccinelle/iterators/device_node_continue.cocci

Get an error report as following:
./drivers/gpu/drm/drm_of.c:292:2-13: ERROR: probable double put.

Device node iterators put the previous value of the index variable,
when find_panel_or_bridge() return non-zero, it will causes a double put.

Fixes: 67bae5f28c89 ("drm: of: Properly try all possible cases for bridge/panel detection")
Signed-off-by: Ziyang Xuan <william.xuanziyang@...wei.com>
---
 drivers/gpu/drm/drm_of.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index f4df344509a8..8c3c0bca1af1 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -289,11 +289,12 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
 			continue;
 
 		ret = find_panel_or_bridge(node, panel, bridge);
-		of_node_put(node);
 
 		/* Stop at the first found occurrence. */
-		if (!ret)
+		if (!ret) {
+			of_node_put(node);
 			return 0;
+		}
 	}
 
 	return -EPROBE_DEFER;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ