Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73c0eab8 authored by Zhouyang Jia's avatar Zhouyang Jia Committed by Greg Kroah-Hartman
Browse files

net: dsa: add error handling for pskb_trim_rcsum



[ Upstream commit 349b71d6 ]

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: default avatarZhouyang Jia <jiazhouyang09@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6bcc27ab
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;