kernel: fix mtk dsa tag padding

The padding intended to avoid corrupted non-zero padding payload was
accidentally adding too many padding bytes, tripping up some setups.
Fix this by using eth_skb_pad instead.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2023-03-02 12:58:16 +01:00 committed by AmadeusGhost
parent 464d31eaa7
commit c9a0d92a3c
2 changed files with 4 additions and 6 deletions

View File

@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/dsa/tag_mtk.c --- a/net/dsa/tag_mtk.c
+++ b/net/dsa/tag_mtk.c +++ b/net/dsa/tag_mtk.c
@@ -25,6 +25,14 @@ static struct sk_buff *mtk_tag_xmit(stru @@ -25,6 +25,13 @@ static struct sk_buff *mtk_tag_xmit(stru
u8 xmit_tpid; u8 xmit_tpid;
u8 *mtk_tag; u8 *mtk_tag;
@ -21,8 +21,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ * corrupted. With tags enabled, we need to make sure that packets are + * corrupted. With tags enabled, we need to make sure that packets are
+ * at least 68 bytes (including FCS and tag). + * at least 68 bytes (including FCS and tag).
+ */ + */
+ if (__skb_put_padto(skb, ETH_ZLEN + MTK_HDR_LEN, false)) + eth_skb_pad(skb);
+ return NULL;
+ +
/* Build the special tag after the MAC Source Address. If VLAN header /* Build the special tag after the MAC Source Address. If VLAN header
* is present, it's required that VLAN header and special tag is * is present, it's required that VLAN header and special tag is

View File

@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/dsa/tag_mtk.c --- a/net/dsa/tag_mtk.c
+++ b/net/dsa/tag_mtk.c +++ b/net/dsa/tag_mtk.c
@@ -25,6 +25,14 @@ static struct sk_buff *mtk_tag_xmit(stru @@ -25,6 +25,13 @@ static struct sk_buff *mtk_tag_xmit(stru
u8 xmit_tpid; u8 xmit_tpid;
u8 *mtk_tag; u8 *mtk_tag;
@ -21,8 +21,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ * corrupted. With tags enabled, we need to make sure that packets are + * corrupted. With tags enabled, we need to make sure that packets are
+ * at least 68 bytes (including FCS and tag). + * at least 68 bytes (including FCS and tag).
+ */ + */
+ if (__skb_put_padto(skb, ETH_ZLEN + MTK_HDR_LEN, false)) + eth_skb_pad(skb);
+ return NULL;
+ +
/* Build the special tag after the MAC Source Address. If VLAN header /* Build the special tag after the MAC Source Address. If VLAN header
* is present, it's required that VLAN header and special tag is * is present, it's required that VLAN header and special tag is