From: Tuo Li <islituo@gmail.com>
To: harry.wentland@amd.com, sunpeng.li@amd.com,
alexander.deucher@amd.com, christian.koenig@amd.com,
Xinhui.Pan@amd.com, airlied@linux.ie, daniel@ffwll.ch,
aric.cyr@amd.com, Jun.Lei@amd.com, qingqing.zhuo@amd.com,
Rodrigo.Siqueira@amd.com, alvin.lee2@amd.com,
vladimir.stempen@amd.com, isabel.zhang@amd.com, sung.lee@amd.com,
paul.hsieh@amd.com, wyatt.wood@amd.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, baijiaju1990@gmail.com,
Tuo Li <islituo@gmail.com>, TOTE Robot <oslab@tsinghua.edu.cn>
Subject: [PATCH] drm/display: fix possible null-pointer dereference in dcn10_set_clock()
Date: Tue, 10 Aug 2021 02:20:04 -0700 [thread overview]
Message-ID: <20210810092004.291429-1-islituo@gmail.com> (raw)
The variable dc->clk_mgr is checked in:
if (dc->clk_mgr && dc->clk_mgr->funcs->get_clock)
This indicates dc->clk_mgr can be NULL.
However, it is dereferenced in:
if (!dc->clk_mgr->funcs->get_clock)
To fix this possible null-pointer dereference, check dc->clk_mgr before
dereferencing it.
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Tuo Li <islituo@gmail.com>
---
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index c545eddabdcc..3a7c7c7efa68 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -3635,7 +3635,7 @@ enum dc_status dcn10_set_clock(struct dc *dc,
dc->clk_mgr->funcs->get_clock(dc->clk_mgr,
context, clock_type, &clock_cfg);
- if (!dc->clk_mgr->funcs->get_clock)
+ if (dc->clk_mgr && !dc->clk_mgr->funcs->get_clock)
return DC_FAIL_UNSUPPORTED_1;
if (clk_khz > clock_cfg.max_clock_khz)
--
2.25.1
next reply other threads:[~2021-08-10 13:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-10 9:20 Tuo Li [this message]
2021-08-10 13:38 ` [PATCH] drm/display: fix possible null-pointer dereference in dcn10_set_clock() Chen, Guchun
2021-08-10 13:55 ` Tuo Li
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=20210810092004.291429-1-islituo@gmail.com \
--to=islituo@gmail.com \
--cc=Jun.Lei@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=alvin.lee2@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aric.cyr@amd.com \
--cc=baijiaju1990@gmail.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=isabel.zhang@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oslab@tsinghua.edu.cn \
--cc=paul.hsieh@amd.com \
--cc=qingqing.zhuo@amd.com \
--cc=sung.lee@amd.com \
--cc=sunpeng.li@amd.com \
--cc=vladimir.stempen@amd.com \
--cc=wyatt.wood@amd.com \
/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: link
Be 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.