Skip to content

Commit

Permalink
net: dsa: ksz: 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 ksz_common_rcv()

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

Fixes: bafe9ba ("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>
Link: https://lore.kernel.org/r/20221201140032.26746-1-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 a789c70 commit 3d8fdcb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/dsa/tag_ksz.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 3d8fdcb

Please sign in to comment.