diff options
author | Eric Dumazet <edumazet@google.com> | 2022-07-08 16:28:58 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-07-09 12:27:33 +0100 |
commit | 44ac441a51a77717e7e66d75591be3aa971a7455 (patch) | |
tree | 23b9e4ea3def7e8462154771229d7879a98aed89 | |
parent | be587adbf88a064e04eb1e65e5e31a75c2bfc9e2 (diff) | |
download | linux-44ac441a51a77717e7e66d75591be3aa971a7455.tar.gz |
af_unix: fix unix_sysctl_register() error path
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>
Acked-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/unix/sysctl_net_unix.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c index 3f1fdffd6092..500129aa710c 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; |