Skip to content

Commit dad4e49

Browse files
Ma Keklassert
authored andcommitted
net: ipv6: fix return value check in esp_remove_trailer
In esp_remove_trailer(), to avoid an unexpected result returned by pskb_trim, we should check the return value of pskb_trim(). Signed-off-by: Ma Ke <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent cc9b364 commit dad4e49

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/ipv6/esp6.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,9 @@ static inline int esp_remove_trailer(struct sk_buff *skb)
770770
skb->csum = csum_block_sub(skb->csum, csumdiff,
771771
skb->len - trimlen);
772772
}
773-
pskb_trim(skb, skb->len - trimlen);
773+
ret = pskb_trim(skb, skb->len - trimlen);
774+
if (unlikely(ret))
775+
return ret;
774776

775777
ret = nexthdr[1];
776778

0 commit comments

Comments
 (0)