[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230717145049.27642-1-ruc_gongyuanjun@163.com>
Date: Mon, 17 Jul 2023 22:50:49 +0800
From: Yuanjun Gong <ruc_gongyuanjun@....com>
To: Yuanjun Gong <ruc_gongyuanjun@....com>,
Jon Maloy <jmaloy@...hat.com>,
Ying Xue <ying.xue@...driver.com>,
netdev@...r.kernel.org
Subject: [PATCH 1/1] net:tipc: check return value of pskb_trim()
goto free_skb if an unexpected result is returned by pskb_tirm()
in tipc_crypto_rcv_complete().
Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@....com>
---
net/tipc/crypto.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c
index 577fa5af33ec..1b86cea261a5 100644
--- a/net/tipc/crypto.c
+++ b/net/tipc/crypto.c
@@ -1894,6 +1894,7 @@ static void tipc_crypto_rcv_complete(struct net *net, struct tipc_aead *aead,
struct tipc_aead *tmp = NULL;
struct tipc_ehdr *ehdr;
struct tipc_node *n;
+ int ret;
/* Is this completed by TX? */
if (unlikely(is_tx(aead->crypto))) {
@@ -1960,7 +1961,9 @@ static void tipc_crypto_rcv_complete(struct net *net, struct tipc_aead *aead,
skb_reset_network_header(*skb);
skb_pull(*skb, tipc_ehdr_size(ehdr));
- pskb_trim(*skb, (*skb)->len - aead->authsize);
+ ret = pskb_trim(*skb, (*skb)->len - aead->authsize);
+ if (ret)
+ goto free_skb;
/* Validate TIPCv2 message */
if (unlikely(!tipc_msg_validate(skb))) {
--
2.17.1
Powered by blists - more mailing lists