Skip to content

Commit

Permalink
net: dsa: hellcreek: Check return value
Browse files Browse the repository at this point in the history
Return NULL if we got unexpected value from skb_trim_rcsum()
in hellcreek_rcv()

Fixes: 01ef09c ("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>
Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>
Link: https://lore.kernel.org/r/20221201140032.26746-2-artem.chernyshev@red-soft.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Artem Chernyshev authored and Jakub Kicinski committed Dec 3, 2022
1 parent 3d8fdcb commit d4edb50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/dsa/tag_hellcreek.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d4edb50

Please sign in to comment.