From: Zhouyang Jia Date: Mon, 11 Jun 2018 05:26:35 +0000 (+0800) Subject: net: dsa: add error handling for pskb_trim_rcsum X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=349b71d6f427ff8211adf50839dbbff3f27c1805;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: David S. Miller --- 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; }