summaryrefslogtreecommitdiff
path: root/net/dsa
diff options
context:
space:
mode:
authorZhouyang Jia <jiazhouyang09@gmail.com>2018-06-11 13:26:35 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-06-26 08:06:28 +0800
commit73c0eab8d2158ef08120e979ce96f4fd80bc4488 (patch)
tree35b0fc3151db0ce990c4c39ed533d7062c44f284 /net/dsa
parent6bcc27abfa62161ef7dae18dfe1bce70865b2aa8 (diff)
net: dsa: add error handling for pskb_trim_rcsum
[ Upstream commit 349b71d6f427ff8211adf50839dbbff3f27c1805 ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/dsa')
-rw-r--r--net/dsa/tag_trailer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c
index fcc9aa72877d..374d586b4a2c 100644
--- a/net/dsa/tag_trailer.c
+++ b/net/dsa/tag_trailer.c
@@ -79,7 +79,8 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,
if (unlikely(ds->cpu_port_mask & BIT(source_port)))
return NULL;
- pskb_trim_rcsum(skb, skb->len - 4);
+ if (pskb_trim_rcsum(skb, skb->len - 4))
+ return NULL;
skb->dev = ds->ports[source_port].netdev;