diff mbox series

[v3,1/3] net: dsa: ksz: Check return value

Message ID 20221201140032.26746-1-artem.chernyshev@red-soft.ru (mailing list archive)
State Accepted
Commit 3d8fdcbf1f42e2bb9ae8b8c0b6f202278c788a22
Delegated to: Netdev Maintainers
Headers show
Series [v3,1/3] net: dsa: ksz: Check return value | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter warning Series does not have a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 3 blamed authors not CCed: marex@denx.de andrew@lunn.ch Tristram.Ha@microchip.com; 6 maintainers not CCed: edumazet@google.com kuba@kernel.org marex@denx.de andrew@lunn.ch pabeni@redhat.com Tristram.Ha@microchip.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Artem Chernyshev Dec. 1, 2022, 2 p.m. UTC
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 <artem.chernyshev@red-soft.ru>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
---
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(-)

Comments

Florian Fainelli Dec. 1, 2022, 9:01 p.m. UTC | #1
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 <artem.chernyshev@red-soft.ru>
> Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
patchwork-bot+netdevbpf@kernel.org Dec. 3, 2022, 5:30 a.m. UTC | #2
Hello:

This series was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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 <artem.chernyshev@red-soft.ru>
> Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
> 
> [...]

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!
diff mbox series

Patch

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);