diff mbox series

fou: fix initialization of grc

Message ID 20240906102839.202798-1-usama.anjum@collabora.com (mailing list archive)
State Accepted
Commit 4c8002277167125078e6b9b90137bdf443ebaa08
Delegated to: Netdev Maintainers
Headers show
Series fou: fix initialization of grc | 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/ynl success Generated files up to date; no warnings/errors; no diff in generated;
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: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
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: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 13 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-09-07--06-00 (tests: 722)

Commit Message

Muhammad Usama Anjum Sept. 6, 2024, 10:28 a.m. UTC
The grc must be initialize first. There can be a condition where if
fou is NULL, goto out will be executed and grc would be used
uninitialized.

Fixes: 7e4196935069 ("fou: Fix null-ptr-deref in GRO.")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 net/ipv4/fou_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kuniyuki Iwashima Sept. 6, 2024, 5:06 p.m. UTC | #1
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
Date: Fri,  6 Sep 2024 15:28:39 +0500
> The grc must be initialize first. There can be a condition where if
> fou is NULL, goto out will be executed and grc would be used
> uninitialized.
> 
> Fixes: 7e4196935069 ("fou: Fix null-ptr-deref in GRO.")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>

Thanks!


> ---
>  net/ipv4/fou_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/fou_core.c b/net/ipv4/fou_core.c
> index 78b869b314921..3e30745e2c09a 100644
> --- a/net/ipv4/fou_core.c
> +++ b/net/ipv4/fou_core.c
> @@ -336,11 +336,11 @@ static struct sk_buff *gue_gro_receive(struct sock *sk,
>  	struct gro_remcsum grc;
>  	u8 proto;
>  
> +	skb_gro_remcsum_init(&grc);
> +
>  	if (!fou)
>  		goto out;
>  
> -	skb_gro_remcsum_init(&grc);
> -
>  	off = skb_gro_offset(skb);
>  	len = off + sizeof(*guehdr);
>  
> -- 
> 2.39.2
patchwork-bot+netdevbpf@kernel.org Sept. 10, 2024, 12:40 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri,  6 Sep 2024 15:28:39 +0500 you wrote:
> The grc must be initialize first. There can be a condition where if
> fou is NULL, goto out will be executed and grc would be used
> uninitialized.
> 
> Fixes: 7e4196935069 ("fou: Fix null-ptr-deref in GRO.")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> 
> [...]

Here is the summary with links:
  - fou: fix initialization of grc
    https://git.kernel.org/netdev/net/c/4c8002277167

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/ipv4/fou_core.c b/net/ipv4/fou_core.c
index 78b869b314921..3e30745e2c09a 100644
--- a/net/ipv4/fou_core.c
+++ b/net/ipv4/fou_core.c
@@ -336,11 +336,11 @@  static struct sk_buff *gue_gro_receive(struct sock *sk,
 	struct gro_remcsum grc;
 	u8 proto;
 
+	skb_gro_remcsum_init(&grc);
+
 	if (!fou)
 		goto out;
 
-	skb_gro_remcsum_init(&grc);
-
 	off = skb_gro_offset(skb);
 	len = off + sizeof(*guehdr);