mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 17:23:25 -05:00
tcp: use 2-arg optimal variant of kfree_rcu()
kfree_rcu(1-arg) should be avoided as much as possible,
since this is only possible from sleepable contexts,
and incurr extra rcu barriers.
I wish the 1-arg variant of kfree_rcu() would
get a distinct name, like kfree_rcu_slow()
to avoid it being abused.
Fixes: 459837b522
("net/tcp: Disable TCP-MD5 static key on tcp_md5sig_info destruction")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Dmitry Safonov <dima@arista.com>
Link: https://lore.kernel.org/r/20221202052847.2623997-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
edd4e25a23
commit
55fb80d518
1 changed files with 2 additions and 2 deletions
|
@ -1245,7 +1245,7 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
|
|||
|
||||
md5sig = rcu_dereference_protected(tp->md5sig_info, lockdep_sock_is_held(sk));
|
||||
rcu_assign_pointer(tp->md5sig_info, NULL);
|
||||
kfree_rcu(md5sig);
|
||||
kfree_rcu(md5sig, rcu);
|
||||
return -EUSERS;
|
||||
}
|
||||
}
|
||||
|
@ -1271,7 +1271,7 @@ int tcp_md5_key_copy(struct sock *sk, const union tcp_md5_addr *addr,
|
|||
md5sig = rcu_dereference_protected(tp->md5sig_info, lockdep_sock_is_held(sk));
|
||||
net_warn_ratelimited("Too many TCP-MD5 keys in the system\n");
|
||||
rcu_assign_pointer(tp->md5sig_info, NULL);
|
||||
kfree_rcu(md5sig);
|
||||
kfree_rcu(md5sig, rcu);
|
||||
return -EUSERS;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue