diff options
author | Daniel Golle <daniel@makrotopia.org> | 2023-02-14 23:25:19 +0000 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2023-02-15 03:28:09 +0000 |
commit | f584fb2f7e6e4c2663c802d5c9367894d9d65f69 (patch) | |
tree | 1d35b91794688d2596189981482b090340cafac6 /target/linux/generic/backport-5.15/733-v6.2-01-net-ethernet-mtk_eth_soc-Avoid-truncating-allocation.patch | |
parent | 80196f4e3c1902325466980b5b4085040b469317 (diff) | |
download | upstream-f584fb2f7e6e4c2663c802d5c9367894d9d65f69.tar.gz upstream-f584fb2f7e6e4c2663c802d5c9367894d9d65f69.tar.bz2 upstream-f584fb2f7e6e4c2663c802d5c9367894d9d65f69.zip |
kernel: import accepted MediaTek Ethernet patches
Import some accepted and pending upstream patches for mtk_eth_soc,
replacing some semantically equivalent local patches and fixing issues
when operating the PCS in 1G SGMII mode.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target/linux/generic/backport-5.15/733-v6.2-01-net-ethernet-mtk_eth_soc-Avoid-truncating-allocation.patch')
-rw-r--r-- | target/linux/generic/backport-5.15/733-v6.2-01-net-ethernet-mtk_eth_soc-Avoid-truncating-allocation.patch | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/target/linux/generic/backport-5.15/733-v6.2-01-net-ethernet-mtk_eth_soc-Avoid-truncating-allocation.patch b/target/linux/generic/backport-5.15/733-v6.2-01-net-ethernet-mtk_eth_soc-Avoid-truncating-allocation.patch new file mode 100644 index 0000000000..2165a824ec --- /dev/null +++ b/target/linux/generic/backport-5.15/733-v6.2-01-net-ethernet-mtk_eth_soc-Avoid-truncating-allocation.patch @@ -0,0 +1,60 @@ +From f3eceaed9edd7c0e0d9fb057613131f92973626f Mon Sep 17 00:00:00 2001 +From: Kees Cook <keescook@chromium.org> +Date: Fri, 27 Jan 2023 14:38:54 -0800 +Subject: [PATCH] net: ethernet: mtk_eth_soc: Avoid truncating allocation + +There doesn't appear to be a reason to truncate the allocation used for +flow_info, so do a full allocation and remove the unused empty struct. +GCC does not like having a reference to an object that has been +partially allocated, as bounds checking may become impossible when +such an object is passed to other code. Seen with GCC 13: + +../drivers/net/ethernet/mediatek/mtk_ppe.c: In function 'mtk_foe_entry_commit_subflow': +../drivers/net/ethernet/mediatek/mtk_ppe.c:623:18: warning: array subscript 'struct mtk_flow_entry[0]' is partly outside array bounds of 'unsigned char[48]' [-Warray-bounds=] + 623 | flow_info->l2_data.base_flow = entry; + | ^~ + +Cc: Felix Fietkau <nbd@nbd.name> +Cc: John Crispin <john@phrozen.org> +Cc: Sean Wang <sean.wang@mediatek.com> +Cc: Mark Lee <Mark-MC.Lee@mediatek.com> +Cc: Lorenzo Bianconi <lorenzo@kernel.org> +Cc: "David S. Miller" <davem@davemloft.net> +Cc: Eric Dumazet <edumazet@google.com> +Cc: Jakub Kicinski <kuba@kernel.org> +Cc: Paolo Abeni <pabeni@redhat.com> +Cc: Matthias Brugger <matthias.bgg@gmail.com> +Cc: netdev@vger.kernel.org +Cc: linux-arm-kernel@lists.infradead.org +Cc: linux-mediatek@lists.infradead.org +Signed-off-by: Kees Cook <keescook@chromium.org> +Reviewed-by: Simon Horman <simon.horman@corigine.com> +Link: https://lore.kernel.org/r/20230127223853.never.014-kees@kernel.org +Signed-off-by: Paolo Abeni <pabeni@redhat.com> +--- + drivers/net/ethernet/mediatek/mtk_ppe.c | 3 +-- + drivers/net/ethernet/mediatek/mtk_ppe.h | 1 - + 2 files changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_ppe.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.c +@@ -601,8 +601,7 @@ mtk_foe_entry_commit_subflow(struct mtk_ + u32 ib1_mask = mtk_get_ib1_pkt_type_mask(ppe->eth) | MTK_FOE_IB1_UDP; + int type; + +- flow_info = kzalloc(offsetof(struct mtk_flow_entry, l2_data.end), +- GFP_ATOMIC); ++ flow_info = kzalloc(sizeof(*flow_info), GFP_ATOMIC); + if (!flow_info) + return; + +--- a/drivers/net/ethernet/mediatek/mtk_ppe.h ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.h +@@ -277,7 +277,6 @@ struct mtk_flow_entry { + struct { + struct mtk_flow_entry *base_flow; + struct hlist_node list; +- struct {} end; + } l2_data; + }; + struct rhash_head node; |