Skip to content

Commit

Permalink
net: dsa: add error handling for pskb_trim_rcsum
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ZhouyangJia authored and davem330 committed Jun 11, 2018
1 parent 0975764 commit 349b71d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/dsa/tag_trailer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 349b71d

Please sign in to comment.