All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] af_unix: fix unix_sysctl_register() error path
@ 2022-07-08 16:28 Eric Dumazet
  2022-07-08 16:30 ` Eric Dumazet
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Dumazet @ 2022-07-08 16:28 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, eric.dumazet, Eric Dumazet, Kuniyuki Iwashima,
	Eric W . Biederman

We want to kfree(table) if @table has been kmalloced,
ie for non initial network namespace.

Fixes: 849d5aa3a1d8 ("af_unix: Do not call kmemdup() for init_net's sysctl table.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
---
 net/unix/sysctl_net_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c
index 3f1fdffd6092c6d06d4f530d813ffcc1b02f3ee4..500129aa710c73537cde5208a48e75842259ee04 100644
--- a/net/unix/sysctl_net_unix.c
+++ b/net/unix/sysctl_net_unix.c
@@ -43,7 +43,7 @@ int __net_init unix_sysctl_register(struct net *net)
 	return 0;
 
 err_reg:
-	if (net_eq(net, &init_net))
+	if (!net_eq(net, &init_net))
 		kfree(table);
 err_alloc:
 	return -ENOMEM;
-- 
2.37.0.rc0.161.g10f37bed90-goog


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

* Re: [PATCH net] af_unix: fix unix_sysctl_register() error path
  2022-07-08 16:28 [PATCH net] af_unix: fix unix_sysctl_register() error path Eric Dumazet
@ 2022-07-08 16:30 ` Eric Dumazet
  2022-07-08 16:41 ` Kuniyuki Iwashima
  2022-07-09 11:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2022-07-08 16:30 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, Eric Dumazet, Kuniyuki Iwashima, Eric W . Biederman

On Fri, Jul 8, 2022 at 6:28 PM Eric Dumazet <edumazet@google.com> wrote:
>
> We want to kfree(table) if @table has been kmalloced,
> ie for non initial network namespace.
>
> Fixes: 849d5aa3a1d8 ("af_unix: Do not call kmemdup() for init_net's sysctl table.")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Kuniyuki Iwashima <kuniyu@amazon.com>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> ---

Wrong tag in [PATCH net], this patch is for net-next tree.

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

* [PATCH net] af_unix: fix unix_sysctl_register() error path
  2022-07-08 16:28 [PATCH net] af_unix: fix unix_sysctl_register() error path Eric Dumazet
  2022-07-08 16:30 ` Eric Dumazet
@ 2022-07-08 16:41 ` Kuniyuki Iwashima
  2022-07-09 11:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2022-07-08 16:41 UTC (permalink / raw)
  To: edumazet; +Cc: davem, ebiederm, eric.dumazet, kuba, kuniyu, netdev, pabeni

From:   Eric Dumazet <edumazet@google.com>
Date:   Fri,  8 Jul 2022 16:28:58 +0000
> We want to kfree(table) if @table has been kmalloced,
> ie for non initial network namespace.
> 
> Fixes: 849d5aa3a1d8 ("af_unix: Do not call kmemdup() for init_net's sysctl table.")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

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

Sorry for my carelessness and thank you for the fix!

Best regards,
Kuniyuki

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

* Re: [PATCH net] af_unix: fix unix_sysctl_register() error path
  2022-07-08 16:28 [PATCH net] af_unix: fix unix_sysctl_register() error path Eric Dumazet
  2022-07-08 16:30 ` Eric Dumazet
  2022-07-08 16:41 ` Kuniyuki Iwashima
@ 2022-07-09 11:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-09 11:40 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: davem, kuba, pabeni, netdev, eric.dumazet, kuniyu, ebiederm

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri,  8 Jul 2022 16:28:58 +0000 you wrote:
> We want to kfree(table) if @table has been kmalloced,
> ie for non initial network namespace.
> 
> Fixes: 849d5aa3a1d8 ("af_unix: Do not call kmemdup() for init_net's sysctl table.")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Kuniyuki Iwashima <kuniyu@amazon.com>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> 
> [...]

Here is the summary with links:
  - [net] af_unix: fix unix_sysctl_register() error path
    https://git.kernel.org/netdev/net-next/c/44ac441a51a7

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] 4+ messages in thread

end of thread, other threads:[~2022-07-09 11:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08 16:28 [PATCH net] af_unix: fix unix_sysctl_register() error path Eric Dumazet
2022-07-08 16:30 ` Eric Dumazet
2022-07-08 16:41 ` Kuniyuki Iwashima
2022-07-09 11:40 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.