tipc: check return value of pskb_trim()
authorYuanjun Gong <ruc_gongyuanjun@163.com>
Tue, 25 Jul 2023 06:48:10 +0000 (14:48 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 27 Jul 2023 08:46:05 +0000 (10:46 +0200)
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 <ruc_gongyuanjun@163.com>
Reviewed-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
Link: https://lore.kernel.org/r/20230725064810.5820-1-ruc_gongyuanjun@163.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/tipc/crypto.c

index 577fa5af33ec7b884c4803f57d564f04e8316def..302fd749c4249a9644dbc907ca5f9d11f8014d2b 100644 (file)
@@ -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))) {