Skip to content

Commit 349b71d

Browse files
ZhouyangJiadavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0975764 commit 349b71d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/dsa/tag_trailer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,
7575
if (!skb->dev)
7676
return NULL;
7777

78-
pskb_trim_rcsum(skb, skb->len - 4);
78+
if (pskb_trim_rcsum(skb, skb->len - 4))
79+
return NULL;
7980

8081
return skb;
8182
}

0 commit comments

Comments
 (0)