summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorArtem Chernyshev <artem.chernyshev@red-soft.ru>2022-12-01 15:00:30 +0100
committerJakub Kicinski <kuba@kernel.org>2022-12-03 05:46:51 +0100
commit3d8fdcbf1f42e2bb9ae8b8c0b6f202278c788a22 (patch)
treeb79be469c8bb05d1ca921cde135ecd5e4c6199a0 /net
parentMerge tag 'for-net-2022-12-02' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff)
downloadlinux-3d8fdcbf1f42e2bb9ae8b8c0b6f202278c788a22.tar.xz
linux-3d8fdcbf1f42e2bb9ae8b8c0b6f202278c788a22.zip
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: 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> Link: https://lore.kernel.org/r/20221201140032.26746-1-artem.chernyshev@red-soft.ru Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/dsa/tag_ksz.c3
1 files changed, 2 insertions, 1 deletions
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);