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] [day] [month] [year] [list]
Message-ID: <14a86f60d026411eb7e4546b8a4879a90f247843.camel@ndufresne.ca>
Date: Wed, 02 Apr 2025 11:40:36 -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

Le mercredi 02 avril 2025 à 11:37 -0400, Nicolas Dufresne a écrit :
> 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>

Sorry for the noise, I see that Hans fixed and merged it already.

Nicolas

> 
> >  	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