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]
Date: Mon, 27 May 2024 16:42:49 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Chen Ni <nichen@...as.ac.cn>
Cc: nbd@....name, sean.wang@...iatek.com, Mark-MC.Lee@...iatek.com,
 lorenzo@...nel.org, davem@...emloft.net, edumazet@...gle.com,
 pabeni@...hat.com, matthias.bgg@...il.com,
 angelogioacchino.delregno@...labora.com, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH net-next v2] net: ethernet: mtk_eth_soc: add missing
 check for rhashtable_init

On Fri, 17 May 2024 10:39:22 +0800 Chen Ni wrote:
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index cae46290a7ae..f9b8956a8726 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -4957,7 +4957,7 @@ static int mtk_probe(struct platform_device *pdev)
>  
>  			eth->ppe[i] = mtk_ppe_init(eth, eth->base + ppe_addr, i);
>  
> -			if (!eth->ppe[i]) {
> +			if (IS_ERR_OR_NULL(eth->ppe[i])) {
>  				err = -ENOMEM;

You still discard the real error here.

>  				goto err_deinit_ppe;
>  			}
> diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
> index 0acee405a749..4895c6febaf8 100644
> --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
> +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
> @@ -884,12 +884,15 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int index)
>  	struct mtk_ppe *ppe;
>  	u32 foe_flow_size;
>  	void *foe;
> +	int ret;
>  
>  	ppe = devm_kzalloc(dev, sizeof(*ppe), GFP_KERNEL);
>  	if (!ppe)
>  		return NULL;

Please convert the return NULL in this function to 
return ERR_PTR(-ENOMEM) and use the error code in mtk_probe()

> -	rhashtable_init(&ppe->l2_flows, &mtk_flow_l2_ht_params);
> +	ret = rhashtable_init(&ppe->l2_flows, &mtk_flow_l2_ht_params);
> +	if (ret)
> +		return ERR_PTR(ret);

Also there are two direct return NULLs without calling rhashtable_destroy()
later in this function. Please fix that in a separate patch.

>  	/* need to allocate a separate device, since it PPE DMA access is
>  	 * not coherent.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ