Commit 89488763 authored by Artem Chernyshev's avatar Artem Chernyshev Committed by Jakub Kicinski

net: dsa: sja1105: Check return value

Return NULL if we got unexpected value from skb_trim_rcsum() in
sja1110_rcv_inband_control_extension()

Fixes: 4913b8eb ("net: dsa: add support for the SJA1110 native tagging protocol")
Signed-off-by: default avatarArtem Chernyshev <artem.chernyshev@red-soft.ru>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20221201140032.26746-3-artem.chernyshev@red-soft.ruSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d4edb506
...@@ -665,7 +665,8 @@ static struct sk_buff *sja1110_rcv_inband_control_extension(struct sk_buff *skb, ...@@ -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 * padding and trailer we need to account for the fact that
* skb->data points to skb_mac_header(skb) + ETH_HLEN. * 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 */ /* Trap-to-host frame, no timestamp trailer */
} else { } else {
*source_port = SJA1110_RX_HEADER_SRC_PORT(rx_header); *source_port = SJA1110_RX_HEADER_SRC_PORT(rx_header);
......
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