diff options
author | Zhouyang Jia <jiazhouyang09@gmail.com> | 2018-06-11 07:26:35 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-06-11 23:19:38 +0200 |
commit | 349b71d6f427ff8211adf50839dbbff3f27c1805 (patch) | |
tree | 24010909255d60d05630e0fa5c949c5d628ebd63 /net | |
parent | ipv6: allow PMTU exceptions to local routes (diff) | |
download | linux-349b71d6f427ff8211adf50839dbbff3f27c1805.tar.xz linux-349b71d6f427ff8211adf50839dbbff3f27c1805.zip |
net: dsa: add error handling for pskb_trim_rcsum
When pskb_trim_rcsum fails, the lack of error-handling code may
cause unexpected results.
This patch adds error-handling code after calling pskb_trim_rcsum.
Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/dsa/tag_trailer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c index 7d20e1f3de28..56197f0d9608 100644 --- a/net/dsa/tag_trailer.c +++ b/net/dsa/tag_trailer.c @@ -75,7 +75,8 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev, if (!skb->dev) return NULL; - pskb_trim_rcsum(skb, skb->len - 4); + if (pskb_trim_rcsum(skb, skb->len - 4)) + return NULL; return skb; } |