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: <YzDHsJ7ilCnEQgUo@lore-desk>
Date:   Sun, 25 Sep 2022 23:27:12 +0200
From:   Lorenzo Bianconi <lorenzo@...nel.org>
To:     Daniel Golle <daniel@...rotopia.org>
Cc:     linux-mediatek@...ts.infradead.org, netdev@...r.kernel.org,
        Sujuan Chen <sujuan.chen@...iatek.com>,
        Bo Jiao <Bo.Jiao@...iatek.com>, Felix Fietkau <nbd@....name>,
        John Crispin <john@...ozen.org>,
        Sean Wang <sean.wang@...iatek.com>,
        Mark Lee <Mark-MC.Lee@...iatek.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Chen Minqiang <ptpt52@...il.com>
Subject: Re: [PATCH 2/2] net: ethernet: mtk_eth_soc: fix usage of
 foe_entry_size

> As sizeof(hwe->data) can now longer be used as the actual size depends
> on foe_entry_size, in commit 9d8cb4c096ab02
> ("net: ethernet: mtk_eth_soc: add foe_entry_size to mtk_eth_soc") the
> use of sizeof(hwe->data) is hence replaced.
> 
> However, replacing it with ppe->eth->soc->foe_entry_size is wrong as
> foe_entry_size represents the size of the whole descriptor and not just
> the 'data' field.
> 
> Fix this by subtracing the size of the only other field in the struct
> 'ib1', so we actually end up with the correct size to be copied to the
> data field.
> 
> Reported-by: Chen Minqiang <ptpt52@...il.com>
> Fixes: 9d8cb4c096ab02 ("net: ethernet: mtk_eth_soc: add foe_entry_size to mtk_eth_soc")
> Signed-off-by: Daniel Golle <daniel@...rotopia.org>

Acked-by: Lorenzo Bianconi <lorenzo@...nel.org>

> ---
>  drivers/net/ethernet/mediatek/mtk_ppe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
> index 4ea2b342f252ac..887f430734f747 100644
> --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
> +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
> @@ -547,7 +547,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry,
>  	}
>  
>  	hwe = mtk_foe_get_entry(ppe, hash);
> -	memcpy(&hwe->data, &entry->data, eth->soc->foe_entry_size);
> +	memcpy(&hwe->data, &entry->data, eth->soc->foe_entry_size - sizeof(hwe->ib1));
>  	wmb();
>  	hwe->ib1 = entry->ib1;
>  
> -- 
> 2.37.3
> 

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists