summaryrefslogtreecommitdiffstats
path: root/net/dsa
diff options
context:
space:
mode:
authorArtem Chernyshev <artem.chernyshev@red-soft.ru>2022-12-01 15:00:32 +0100
committerJakub Kicinski <kuba@kernel.org>2022-12-03 05:46:52 +0100
commit8948876335b1752176afdff8e704099a3ea0f6e6 (patch)
treed2897b79825eace061b67d0171df6fc341c20f55 /net/dsa
parentnet: dsa: hellcreek: Check return value (diff)
downloadlinux-8948876335b1752176afdff8e704099a3ea0f6e6.tar.xz
linux-8948876335b1752176afdff8e704099a3ea0f6e6.zip
net: dsa: sja1105: Check return value
Return NULL if we got unexpected value from skb_trim_rcsum() in sja1110_rcv_inband_control_extension() Fixes: 4913b8ebf8a9 ("net: dsa: add support for the SJA1110 native tagging protocol") Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20221201140032.26746-3-artem.chernyshev@red-soft.ru Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/dsa')
-rw-r--r--net/dsa/tag_sja1105.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c
index 83e4136516b0..1a85125bda6d 100644
--- a/net/dsa/tag_sja1105.c
+++ b/net/dsa/tag_sja1105.c
@@ -665,7 +665,8 @@ static struct sk_buff *sja1110_rcv_inband_control_extension(struct sk_buff *skb,
* padding and trailer we need to account for the fact that
* skb->data points to skb_mac_header(skb) + ETH_HLEN.
*/
- pskb_trim_rcsum(skb, start_of_padding - ETH_HLEN);
+ if (pskb_trim_rcsum(skb, start_of_padding - ETH_HLEN))
+ return NULL;
/* Trap-to-host frame, no timestamp trailer */
} else {
*source_port = SJA1110_RX_HEADER_SRC_PORT(rx_header);