From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "Stuart Lee (李翰)" <Stuart.Lee@mediatek.com>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Cc: "Pablo Sun (孫毓翔)" <pablo.sun@mediatek.com>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Shawn Sung (宋孝謙)" <Shawn.Sung@mediatek.com>,
"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"daniel@ffwll.ch" <daniel@ffwll.ch>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"Macpaul Lin (林智斌)" <Macpaul.Lin@mediatek.com>,
"airlied@gmail.com" <airlied@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"Lancelot Wu (吳瑋晟)" <Lancelot.Wu@mediatek.com>
Subject: Re: [PATCH 1/1] drm/mediatek: Fix access violation in mtk_drm_crtc_dma_dev_get
Date: Fri, 10 Nov 2023 02:00:29 +0000 [thread overview]
Message-ID: <f7c0a90a7f2302a53029c1cafd0b64271b2e546c.camel@mediatek.com> (raw)
In-Reply-To: <20231110012914.14884-2-stuart.lee@mediatek.com>
Hi, Stuart:
On Fri, 2023-11-10 at 09:29 +0800, Stuart Lee wrote:
> Add error handling to check NULL input in
> mtk_drm_crtc_dma_dev_get function.
>
> While display path is not configured correctly, none of crtc is
> established. So the caller of mtk_drm_crtc_dma_dev_get may pass
> input parameter *crtc as NULL, Which may cause coredump when
> we try to get the container of NULL pointer.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
>
> Fixes: cb1d6bcca542 ("drm/mediatek: Add dma dev get function")
> Signed-off-by: Stuart Lee <stuart.lee@mediatek.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index c277b9fae950..047c9a31d306 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -921,7 +921,14 @@ static int mtk_drm_crtc_init_comp_planes(struct
> drm_device *drm_dev,
>
> struct device *mtk_drm_crtc_dma_dev_get(struct drm_crtc *crtc)
> {
> - struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
> + struct mtk_drm_crtc *mtk_crtc = NULL;
> +
> + if (!crtc)
> + return NULL;
> +
> + mtk_crtc = to_mtk_crtc(crtc);
> + if (!mtk_crtc)
> + return NULL;
>
> return mtk_crtc->dma_dev;
> }
next prev parent reply other threads:[~2023-11-10 2:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 1:29 [PATCH 0/1] " Stuart Lee
2023-11-10 1:29 ` [PATCH 1/1] drm/mediatek: " Stuart Lee
2023-11-10 2:00 ` CK Hu (胡俊光) [this message]
2023-11-10 11:57 ` AngeloGioacchino Del Regno
2023-12-11 14:44 ` Chun-Kuang Hu
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=f7c0a90a7f2302a53029c1cafd0b64271b2e546c.camel@mediatek.com \
--to=ck.hu@mediatek.com \
--cc=Lancelot.Wu@mediatek.com \
--cc=Macpaul.Lin@mediatek.com \
--cc=Nancy.Lin@mediatek.com \
--cc=Shawn.Sung@mediatek.com \
--cc=Stuart.Lee@mediatek.com \
--cc=airlied@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=pablo.sun@mediatek.com \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®