netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net:tipc: check return value of pskb_trim()
@ 2023-07-17 14:50 Yuanjun Gong
  2023-07-17 18:57 ` Kuniyuki Iwashima
  0 siblings, 1 reply; 5+ messages in thread
From: Yuanjun Gong @ 2023-07-17 14:50 UTC (permalink / raw)
  To: Yuanjun Gong, Jon Maloy, Ying Xue, netdev

goto free_skb if an unexpected result is returned by pskb_tirm()
in tipc_crypto_rcv_complete().

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-27  8:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 14:50 [PATCH 1/1] net:tipc: check return value of pskb_trim() Yuanjun Gong
2023-07-17 18:57 ` Kuniyuki Iwashima
2023-07-25  6:48   ` [PATCH v2 1/1] tipc: " Yuanjun Gong
2023-07-25  7:19     ` Tung Quang Nguyen
2023-07-27  8:50     ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).