2022-12-01 14:12:30

by Artem Chernyshev

[permalink] [raw]
Subject: [PATCH v3 1/3] net: dsa: ksz: Check return value

Return NULL if we got unexpected value from skb_trim_rcsum()
in ksz_common_rcv()

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: bafe9ba7d908 ("net: dsa: ksz: Factor out common tag code")
Signed-off-by: Artem Chernyshev <[email protected]>
Reviewed-by: Vladimir Oltean <[email protected]>
---
V1->V2 Fixes for tag_hellcreek.c and tag_sja1105.c
V2->V3 Split patch in 3 separate parts

net/dsa/tag_ksz.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
index 38fa19c1e2d5..429250298ac4 100644
--- a/net/dsa/tag_ksz.c
+++ b/net/dsa/tag_ksz.c
@@ -21,7 +21,8 @@ static struct sk_buff *ksz_common_rcv(struct sk_buff *skb,
if (!skb->dev)
return NULL;

- pskb_trim_rcsum(skb, skb->len - len);
+ if (pskb_trim_rcsum(skb, skb->len - len))
+ return NULL;

dsa_default_offload_fwd_mark(skb);

--
2.30.3


2022-12-01 14:12:35

by Artem Chernyshev

[permalink] [raw]
Subject: [PATCH v3 3/3] net: dsa: sja1105: Check return value

Return NULL if we got unexpected value from skb_trim_rcsum() in
sja1110_rcv_inband_control_extension()

Fixes: 4913b8ebf8a9 ("net: dsa: add support for the SJA1110 native tagging protocol")
Signed-off-by: Artem Chernyshev <[email protected]>
---
V1->V2 Fixes for tag_hellcreek.c and tag_sja1105.c
V2->V3 Split patch in 3 separate parts

net/dsa/tag_sja1105.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c
index 83e4136516b0..1a85125bda6d 100644
--- a/net/dsa/tag_sja1105.c
+++ b/net/dsa/tag_sja1105.c
@@ -665,7 +665,8 @@ static struct sk_buff *sja1110_rcv_inband_control_extension(struct sk_buff *skb,
* padding and trailer we need to account for the fact that
* skb->data points to skb_mac_header(skb) + ETH_HLEN.
*/
- pskb_trim_rcsum(skb, start_of_padding - ETH_HLEN);
+ if (pskb_trim_rcsum(skb, start_of_padding - ETH_HLEN))
+ return NULL;
/* Trap-to-host frame, no timestamp trailer */
} else {
*source_port = SJA1110_RX_HEADER_SRC_PORT(rx_header);
--
2.30.3

2022-12-01 21:12:44

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v3 3/3] net: dsa: sja1105: Check return value



On 12/1/2022 6:00 AM, Artem Chernyshev wrote:
> Return NULL if we got unexpected value from skb_trim_rcsum() in
> sja1110_rcv_inband_control_extension()
>
> Fixes: 4913b8ebf8a9 ("net: dsa: add support for the SJA1110 native tagging protocol")
> Signed-off-by: Artem Chernyshev <[email protected]>

Reviewed-by: Florian Fainelli <[email protected]>
--
Florian

2022-12-01 21:41:46

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] net: dsa: ksz: Check return value



On 12/1/2022 6:00 AM, Artem Chernyshev wrote:
> Return NULL if we got unexpected value from skb_trim_rcsum()
> in ksz_common_rcv()
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: bafe9ba7d908 ("net: dsa: ksz: Factor out common tag code")
> Signed-off-by: Artem Chernyshev <[email protected]>
> Reviewed-by: Vladimir Oltean <[email protected]>

Reviewed-by: Florian Fainelli <[email protected]>
--
Florian

2022-12-03 06:17:28

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] net: dsa: ksz: Check return value

Hello:

This series was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

On Thu, 1 Dec 2022 17:00:30 +0300 you wrote:
> Return NULL if we got unexpected value from skb_trim_rcsum()
> in ksz_common_rcv()
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: bafe9ba7d908 ("net: dsa: ksz: Factor out common tag code")
> Signed-off-by: Artem Chernyshev <[email protected]>
> Reviewed-by: Vladimir Oltean <[email protected]>
>
> [...]

Here is the summary with links:
- [v3,1/3] net: dsa: ksz: Check return value
https://git.kernel.org/netdev/net/c/3d8fdcbf1f42
- [v3,2/3] net: dsa: hellcreek: Check return value
https://git.kernel.org/netdev/net/c/d4edb5068865
- [v3,3/3] net: dsa: sja1105: Check return value
https://git.kernel.org/netdev/net/c/8948876335b1

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html