* [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
* Re: [PATCH 1/1] net:tipc: check return value of pskb_trim()
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
0 siblings, 1 reply; 5+ messages in thread
From: Kuniyuki Iwashima @ 2023-07-17 18:57 UTC (permalink / raw)
To: ruc_gongyuanjun; +Cc: jmaloy, netdev, ying.xue, kuniyu
From: Yuanjun Gong <ruc_gongyuanjun@163.com>
Date: Mon, 17 Jul 2023 22:50:49 +0800
> 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)
No need to define ret.
> + goto free_skb;
>
> /* Validate TIPCv2 message */
> if (unlikely(!tipc_msg_validate(skb))) {
> --
> 2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/1] tipc: check return value of pskb_trim()
2023-07-17 18:57 ` Kuniyuki Iwashima
@ 2023-07-25 6:48 ` Yuanjun Gong
2023-07-25 7:19 ` Tung Quang Nguyen
2023-07-27 8:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Yuanjun Gong @ 2023-07-25 6:48 UTC (permalink / raw)
To: kuniyu; +Cc: jmaloy, netdev, ruc_gongyuanjun, ying.xue
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>
---
net/tipc/crypto.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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 @@ 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);
+ if (pskb_trim(*skb, (*skb)->len - aead->authsize))
+ 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
* RE: [PATCH v2 1/1] tipc: check return value of pskb_trim()
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
1 sibling, 0 replies; 5+ messages in thread
From: Tung Quang Nguyen @ 2023-07-25 7:19 UTC (permalink / raw)
To: Yuanjun Gong
Cc: jmaloy@redhat.com, netdev@vger.kernel.org, ying.xue@windriver.com,
kuniyu@amazon.com
>Subject: [PATCH v2 1/1] 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 <ruc_gongyuanjun@163.com>
>---
> net/tipc/crypto.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>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 @@ 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);
>+ if (pskb_trim(*skb, (*skb)->len - aead->authsize))
>+ goto free_skb;
>
> /* Validate TIPCv2 message */
> if (unlikely(!tipc_msg_validate(skb))) {
>--
>2.17.1
>
Reviewed-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] tipc: check return value of pskb_trim()
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
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-27 8:50 UTC (permalink / raw)
To: Yuanjun Gong; +Cc: kuniyu, jmaloy, netdev, ying.xue
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 25 Jul 2023 14:48:10 +0800 you wrote:
> 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>
> ---
> net/tipc/crypto.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Here is the summary with links:
- [v2,1/1] tipc: check return value of pskb_trim()
https://git.kernel.org/netdev/net/c/e46e06ffc6d6
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [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).