From: Yuanjun Gong Date: Tue, 25 Jul 2023 06:48:10 +0000 (+0800) Subject: tipc: check return value of pskb_trim() X-Git-Tag: v6.6.17~4313^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e46e06ffc6d667a89b979701288e2264f45e6a7b;p=platform%2Fkernel%2Flinux-rpi.git tipc: check return value of pskb_trim() goto free_skb if an unexpected result is returned by pskb_tirm() in tipc_crypto_rcv_complete(). Fixes: fc1b6d6de220 ("tipc: introduce TIPC encryption & authentication") Signed-off-by: Yuanjun Gong Reviewed-by: Tung Nguyen Link: https://lore.kernel.org/r/20230725064810.5820-1-ruc_gongyuanjun@163.com Signed-off-by: Paolo Abeni --- diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c index 577fa5af33ec..302fd749c424 100644 --- a/net/tipc/crypto.c +++ b/net/tipc/crypto.c @@ -1960,7 +1960,8 @@ rcv: skb_reset_network_header(*skb); skb_pull(*skb, tipc_ehdr_size(ehdr)); - pskb_trim(*skb, (*skb)->len - aead->authsize); + if (pskb_trim(*skb, (*skb)->len - aead->authsize)) + goto free_skb; /* Validate TIPCv2 message */ if (unlikely(!tipc_msg_validate(skb))) {