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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cfc905988dda23078b5086f3eb0975863bbb6c2d.camel@ndufresne.ca>
Date: Wed, 02 Apr 2025 11:37:32 -0400
From: Nicolas Dufresne <nicolas@...fresne.ca>
To: Miaoqian Lin <linmq006@...il.com>, Tiffany Lin
 <tiffany.lin@...iatek.com>,  Andrew-CT Chen <andrew-ct.chen@...iatek.com>,
 Yunfei Dong <yunfei.dong@...iatek.com>, Mauro Carvalho Chehab	
 <mchehab@...nel.org>, Matthias Brugger <matthias.bgg@...il.com>, 
 AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
 Fullway Wang <fullwaywang@...look.com>, 	linux-media@...r.kernel.org,
 linux-kernel@...r.kernel.org, 	linux-arm-kernel@...ts.infradead.org,
 linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH] media: mtk-vcodec: Fix reference count leak in
 mtk_vcodec_fw_scp_init

Hi,

Le mardi 18 mars 2025 à 19:05 +0800, Miaoqian Lin a écrit :
> scp_get() returns a reference that needs to be released with scp_put().
> Add missing scp_put() before returning error in mtk_vcodec_fw_scp_init().
> 
> Fixes: 53dbe0850444 ("media: mtk-vcodec: potential null pointer deference in SCP")
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
>  .../platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c      | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c
> index ff23b225db70..11ab3bc60217 100644
> --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c
> +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c
> @@ -71,7 +71,6 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use
>  		pr_err("Invalid fw_use %d (use a reasonable fw id here)\n", fw_use);
>  		return ERR_PTR(-EINVAL);
>  	}
> -

Might sound nit-picky, but don't do style fixes in patches intended for
backports. It increases the chance of conflicts.

>  	scp = scp_get(plat_dev);
>  	if (!scp) {
>  		dev_err(&plat_dev->dev, "could not get vdec scp handle");
> @@ -79,8 +78,10 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use
>  	}
>  
>  	fw = devm_kzalloc(&plat_dev->dev, sizeof(*fw), GFP_KERNEL);
> -	if (!fw)
> +	if (!fw) {
> +		scp_put(scp);
>  		return ERR_PTR(-ENOMEM);
> +	}

With the above style change removed:

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@...llabora.com>

>  	fw->type = SCP;
>  	fw->ops = &mtk_vcodec_rproc_msg;
>  	fw->scp = scp;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ