Commit 44ac441a authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

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: 849d5aa3 ("af_unix: Do not call kmemdup() for init_net's sysctl table.")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent be587adb
...@@ -43,7 +43,7 @@ int __net_init unix_sysctl_register(struct net *net) ...@@ -43,7 +43,7 @@ int __net_init unix_sysctl_register(struct net *net)
return 0; return 0;
err_reg: err_reg:
if (net_eq(net, &init_net)) if (!net_eq(net, &init_net))
kfree(table); kfree(table);
err_alloc: err_alloc:
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment