* [PATCH net 1/3] net: dsa: rtl4_a: Pad using __skb_put_padto()
@ 2021-03-01 13:32 Linus Walleij
2021-03-01 13:32 ` [PATCH net 2/3] net: dsa: rtl4_a: Drop skb_cow_head() Linus Walleij
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Linus Walleij @ 2021-03-01 13:32 UTC (permalink / raw)
To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
David S . Miller, Jakub Kicinski
Cc: netdev, Linus Walleij, DENG Qingfang, Mauri Sandberg
The eth_skb_pad() function will cause a double free
on failure since dsa_slave_xmit() will try to free
the frame if we return NULL. Fix this by using
__skb_put_padto() instead.
Fixes: 86dd9868b878 ("net: dsa: tag_rtl4_a: Support also egress tags")
Reported-by: DENG Qingfang <dqfext@gmail.com>
Cc: Mauri Sandberg <sandberg@mailfence.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
net/dsa/tag_rtl4_a.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c
index c17d39b4a1a0..804d756dd80a 100644
--- a/net/dsa/tag_rtl4_a.c
+++ b/net/dsa/tag_rtl4_a.c
@@ -40,7 +40,7 @@ static struct sk_buff *rtl4a_tag_xmit(struct sk_buff *skb,
u16 out;
/* Pad out to at least 60 bytes */
- if (unlikely(eth_skb_pad(skb)))
+ if (__skb_put_padto(skb, ETH_ZLEN, false))
return NULL;
if (skb_cow_head(skb, RTL4_A_HDR_LEN) < 0)
return NULL;
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net 2/3] net: dsa: rtl4_a: Drop skb_cow_head()
2021-03-01 13:32 [PATCH net 1/3] net: dsa: rtl4_a: Pad using __skb_put_padto() Linus Walleij
@ 2021-03-01 13:32 ` Linus Walleij
2021-03-02 1:41 ` Florian Fainelli
2021-03-01 13:32 ` [PATCH net 3/3] net: dsa: rtl4_a: Syntax fixes Linus Walleij
2021-03-02 1:41 ` [PATCH net 1/3] net: dsa: rtl4_a: Pad using __skb_put_padto() Florian Fainelli
2 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2021-03-01 13:32 UTC (permalink / raw)
To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
David S . Miller, Jakub Kicinski
Cc: netdev, Linus Walleij, DENG Qingfang, Mauri Sandberg
The DSA core already provides the tag headroom, drop this.
Fixes: 86dd9868b878 ("net: dsa: tag_rtl4_a: Support also egress tags")
Reported-by: Andrew Lunn <andrew@lunn.ch>
Reported-by: DENG Qingfang <dqfext@gmail.com>
Cc: Mauri Sandberg <sandberg@mailfence.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
net/dsa/tag_rtl4_a.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c
index 804d756dd80a..8098d81f660b 100644
--- a/net/dsa/tag_rtl4_a.c
+++ b/net/dsa/tag_rtl4_a.c
@@ -42,8 +42,6 @@ static struct sk_buff *rtl4a_tag_xmit(struct sk_buff *skb,
/* Pad out to at least 60 bytes */
if (__skb_put_padto(skb, ETH_ZLEN, false))
return NULL;
- if (skb_cow_head(skb, RTL4_A_HDR_LEN) < 0)
- return NULL;
netdev_dbg(dev, "add realtek tag to package to port %d\n",
dp->index);
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net 3/3] net: dsa: rtl4_a: Syntax fixes
2021-03-01 13:32 [PATCH net 1/3] net: dsa: rtl4_a: Pad using __skb_put_padto() Linus Walleij
2021-03-01 13:32 ` [PATCH net 2/3] net: dsa: rtl4_a: Drop skb_cow_head() Linus Walleij
@ 2021-03-01 13:32 ` Linus Walleij
2021-03-02 1:41 ` Florian Fainelli
2021-03-02 1:41 ` [PATCH net 1/3] net: dsa: rtl4_a: Pad using __skb_put_padto() Florian Fainelli
2 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2021-03-01 13:32 UTC (permalink / raw)
To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
David S . Miller, Jakub Kicinski
Cc: netdev, Linus Walleij, DENG Qingfang, Mauri Sandberg
Some errors spotted in the initial patch: use reverse
christmas tree for nice code looks and fix a spelling
mistake.
Reported-by: Andrew Lunn <andrew@lunn.ch>
Reported-by: DENG Qingfang <dqfext@gmail.com>
Cc: Mauri Sandberg <sandberg@mailfence.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
net/dsa/tag_rtl4_a.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c
index 8098d81f660b..9da56c5ea9dc 100644
--- a/net/dsa/tag_rtl4_a.c
+++ b/net/dsa/tag_rtl4_a.c
@@ -36,8 +36,8 @@ static struct sk_buff *rtl4a_tag_xmit(struct sk_buff *skb,
{
struct dsa_port *dp = dsa_slave_to_port(dev);
u8 *tag;
- u16 *p;
u16 out;
+ u16 *p;
/* Pad out to at least 60 bytes */
if (__skb_put_padto(skb, ETH_ZLEN, false))
@@ -55,7 +55,7 @@ static struct sk_buff *rtl4a_tag_xmit(struct sk_buff *skb,
*p = htons(RTL4_A_ETHERTYPE);
out = (RTL4_A_PROTOCOL_RTL8366RB << 12) | (2 << 8);
- /* The lower bits is the port numer */
+ /* The lower bits are the port numer */
out |= (u8)dp->index;
p = (u16 *)(tag + 2);
*p = htons(out);
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net 1/3] net: dsa: rtl4_a: Pad using __skb_put_padto()
2021-03-01 13:32 [PATCH net 1/3] net: dsa: rtl4_a: Pad using __skb_put_padto() Linus Walleij
2021-03-01 13:32 ` [PATCH net 2/3] net: dsa: rtl4_a: Drop skb_cow_head() Linus Walleij
2021-03-01 13:32 ` [PATCH net 3/3] net: dsa: rtl4_a: Syntax fixes Linus Walleij
@ 2021-03-02 1:41 ` Florian Fainelli
2 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2021-03-02 1:41 UTC (permalink / raw)
To: Linus Walleij, Andrew Lunn, Vivien Didelot, Vladimir Oltean,
David S . Miller, Jakub Kicinski
Cc: netdev, DENG Qingfang, Mauri Sandberg
On 3/1/2021 5:32 AM, Linus Walleij wrote:
> The eth_skb_pad() function will cause a double free
> on failure since dsa_slave_xmit() will try to free
> the frame if we return NULL. Fix this by using
> __skb_put_padto() instead.
>
> Fixes: 86dd9868b878 ("net: dsa: tag_rtl4_a: Support also egress tags")
> Reported-by: DENG Qingfang <dqfext@gmail.com>
> Cc: Mauri Sandberg <sandberg@mailfence.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net 2/3] net: dsa: rtl4_a: Drop skb_cow_head()
2021-03-01 13:32 ` [PATCH net 2/3] net: dsa: rtl4_a: Drop skb_cow_head() Linus Walleij
@ 2021-03-02 1:41 ` Florian Fainelli
0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2021-03-02 1:41 UTC (permalink / raw)
To: Linus Walleij, Andrew Lunn, Vivien Didelot, Vladimir Oltean,
David S . Miller, Jakub Kicinski
Cc: netdev, DENG Qingfang, Mauri Sandberg
On 3/1/2021 5:32 AM, Linus Walleij wrote:
> The DSA core already provides the tag headroom, drop this.
>
> Fixes: 86dd9868b878 ("net: dsa: tag_rtl4_a: Support also egress tags")
> Reported-by: Andrew Lunn <andrew@lunn.ch>
> Reported-by: DENG Qingfang <dqfext@gmail.com>
> Cc: Mauri Sandberg <sandberg@mailfence.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net 3/3] net: dsa: rtl4_a: Syntax fixes
2021-03-01 13:32 ` [PATCH net 3/3] net: dsa: rtl4_a: Syntax fixes Linus Walleij
@ 2021-03-02 1:41 ` Florian Fainelli
0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2021-03-02 1:41 UTC (permalink / raw)
To: Linus Walleij, Andrew Lunn, Vivien Didelot, Vladimir Oltean,
David S . Miller, Jakub Kicinski
Cc: netdev, DENG Qingfang, Mauri Sandberg
On 3/1/2021 5:32 AM, Linus Walleij wrote:
> Some errors spotted in the initial patch: use reverse
> christmas tree for nice code looks and fix a spelling
> mistake.
>
> Reported-by: Andrew Lunn <andrew@lunn.ch>
> Reported-by: DENG Qingfang <dqfext@gmail.com>
> Cc: Mauri Sandberg <sandberg@mailfence.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-03-02 8:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 13:32 [PATCH net 1/3] net: dsa: rtl4_a: Pad using __skb_put_padto() Linus Walleij
2021-03-01 13:32 ` [PATCH net 2/3] net: dsa: rtl4_a: Drop skb_cow_head() Linus Walleij
2021-03-02 1:41 ` Florian Fainelli
2021-03-01 13:32 ` [PATCH net 3/3] net: dsa: rtl4_a: Syntax fixes Linus Walleij
2021-03-02 1:41 ` Florian Fainelli
2021-03-02 1:41 ` [PATCH net 1/3] net: dsa: rtl4_a: Pad using __skb_put_padto() Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).