Skip to content

Commit

Permalink
af_unix: fix unix_sysctl_register() error path
Browse files Browse the repository at this point in the history
We want to kfree(table) if @table has been kmalloced,
ie for non initial network namespace.

Fixes: 849d5aa ("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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jul 9, 2022
1 parent be587ad commit 44ac441
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/unix/sysctl_net_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 44ac441

Please sign in to comment.