diff mbox series

[v3,2/3] net: dsa: hellcreek: Check return value

Message ID 20221201140032.26746-2-artem.chernyshev@red-soft.ru (mailing list archive)
State Accepted
Commit d4edb50688652eb10be270bc515da63815de428f
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 1 blamed authors not CCed: kuba@kernel.org; 4 maintainers not CCed: edumazet@google.com davem@davemloft.net pabeni@redhat.com kuba@kernel.org
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 hellcreek_rcv()

Fixes: 01ef09caad66 ("net: dsa: Add tag handling for Hirschmann Hellcreek switches")
Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
---
V1->V2 Fixes for tag_hellcreek.c and tag_sja1105.c
V2->V3 Split patch in 3 separate parts

 net/dsa/tag_hellcreek.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 hellcreek_rcv()
> 
> Fixes: 01ef09caad66 ("net: dsa: Add tag handling for Hirschmann Hellcreek switches")
> Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Kurt Kanzenbach Dec. 2, 2022, 7:54 a.m. UTC | #2
On Thu Dec 01 2022, Artem Chernyshev wrote:
> Return NULL if we got unexpected value from skb_trim_rcsum() 
                                              ^ pskb_trim_rcsum()
> in hellcreek_rcv()

For the next time, a change log should rather explain *why* a change is
made instead of *what* the patch is doing.

Other than that,

Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>
diff mbox series

Patch

diff --git a/net/dsa/tag_hellcreek.c b/net/dsa/tag_hellcreek.c
index 846588c0070a..53a206d11685 100644
--- a/net/dsa/tag_hellcreek.c
+++ b/net/dsa/tag_hellcreek.c
@@ -49,7 +49,8 @@  static struct sk_buff *hellcreek_rcv(struct sk_buff *skb,
 		return NULL;
 	}
 
-	pskb_trim_rcsum(skb, skb->len - HELLCREEK_TAG_LEN);
+	if (pskb_trim_rcsum(skb, skb->len - HELLCREEK_TAG_LEN))
+		return NULL;
 
 	dsa_default_offload_fwd_mark(skb);