diff mbox series

[v2,1/1] tipc: check return value of pskb_trim()

Message ID 20230725064810.5820-1-ruc_gongyuanjun@163.com (mailing list archive)
State Accepted
Commit e46e06ffc6d667a89b979701288e2264f45e6a7b
Delegated to: Netdev Maintainers
Headers show
Series [v2,1/1] tipc: check return value of pskb_trim() | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1342 this patch: 1342
netdev/cc_maintainers fail 2 blamed authors not CCed: tuong.t.lien@dektech.com.au davem@davemloft.net; 6 maintainers not CCed: kuba@kernel.org tipc-discussion@lists.sourceforge.net tuong.t.lien@dektech.com.au davem@davemloft.net pabeni@redhat.com edumazet@google.com
netdev/build_clang success Errors and warnings before: 1365 this patch: 1365
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1365 this patch: 1365
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yuanjun Gong July 25, 2023, 6:48 a.m. UTC
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(-)

Comments

Tung Quang Nguyen July 25, 2023, 7:19 a.m. UTC | #1
>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>
patchwork-bot+netdevbpf@kernel.org July 27, 2023, 8:50 a.m. UTC | #2
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!
diff mbox series

Patch

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))) {