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: <20240216062825.165627-1-harshit.m.mogalapalli@oracle.com>
Date: Thu, 15 Feb 2024 22:28:22 -0800
From: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
To: Harry Wentland <harry.wentland@....com>, Leo Li <sunpeng.li@....com>,
        Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
        Alex Deucher <alexander.deucher@....com>,
        Christian König <christian.koenig@....com>,
        "Pan, Xinhui" <Xinhui.Pan@....com>, David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>,
        Nicholas Kazlauskas <nicholas.kazlauskas@....com>,
        Alvin Lee <alvin.lee2@....com>, Qingqing Zhuo <Qingqing.Zhuo@....com>,
        Wayne Lin <wayne.lin@....com>, Duncan Ma <duncan.ma@....com>,
        Samson Tam <samson.tam@....com>, "JinZe.Xu" <jinze.xu@....com>,
        Josip Pavic <Josip.Pavic@....com>, Cruise Hung <cruise.hung@....com>,
        Hersen Wu <hersenxs.wu@....com>, amd-gfx@...ts.freedesktop.org,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, dan.carpenter@...aro.org,
        Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>,
        kernel test robot <lkp@...el.com>, Dan Carpenter <error27@...il.com>
Subject: [PATCH] drm/amd/display: fix a possible NULL dereference bug

Smatch warns:
	drivers/gpu/drm/amd/amdgpu/../display/dc/dc_dmub_srv.c:136
	dc_dmub_srv_cmd_list_queue_execute() warn: variable dereferenced
	before check 'dc_dmub_srv' (see line 131)

Fix this by moving the dereference "dc_dmub_srv->ctx" after the NULL check.

Fixes: 028bac583449 ("drm/amd/display: decouple dmcub execution to reduce lock granularity")
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <error27@...il.com>
Closes: https://lore.kernel.org/r/202311141141.GoLAPxD5-lkp@intel.com/
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
---
Only compile tested
---
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
index 0bc32537e2eb..a4bd46ec6da4 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
+++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
@@ -128,7 +128,7 @@ bool dc_dmub_srv_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srv,
 		unsigned int count,
 		union dmub_rb_cmd *cmd_list)
 {
-	struct dc_context *dc_ctx = dc_dmub_srv->ctx;
+	struct dc_context *dc_ctx;
 	struct dmub_srv *dmub;
 	enum dmub_status status;
 	int i;
@@ -136,6 +136,7 @@ bool dc_dmub_srv_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srv,
 	if (!dc_dmub_srv || !dc_dmub_srv->dmub)
 		return false;
 
+	dc_ctx = dc_dmub_srv->ctx;
 	dmub = dc_dmub_srv->dmub;
 
 	for (i = 0 ; i < count; i++) {
-- 
2.39.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ