Commit 3d8fdcbf authored by Artem Chernyshev's avatar Artem Chernyshev Committed by Jakub Kicinski

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: bafe9ba7 ("net: dsa: ksz: Factor out common tag code")
Signed-off-by: default avatarArtem Chernyshev <artem.chernyshev@red-soft.ru>
Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20221201140032.26746-1-artem.chernyshev@red-soft.ruSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent a789c70c
...@@ -21,7 +21,8 @@ static struct sk_buff *ksz_common_rcv(struct sk_buff *skb, ...@@ -21,7 +21,8 @@ static struct sk_buff *ksz_common_rcv(struct sk_buff *skb,
if (!skb->dev) if (!skb->dev)
return NULL; 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); dsa_default_offload_fwd_mark(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment