|
|
@@ -332,7 +332,8 @@ out:
|
|
|
* tcp_reinit_congestion_control (if the current congestion control was
|
|
|
* already initialized.
|
|
|
*/
|
|
|
-int tcp_set_congestion_control(struct sock *sk, const char *name, bool load, bool reinit)
|
|
|
+int tcp_set_congestion_control(struct sock *sk, const char *name, bool load,
|
|
|
+ bool reinit, bool cap_net_admin)
|
|
|
{
|
|
|
struct inet_connection_sock *icsk = inet_csk(sk);
|
|
|
const struct tcp_congestion_ops *ca;
|
|
|
@@ -368,8 +369,7 @@ int tcp_set_congestion_control(struct sock *sk, const char *name, bool load, boo
|
|
|
} else {
|
|
|
err = -EBUSY;
|
|
|
}
|
|
|
- } else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) ||
|
|
|
- ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN))) {
|
|
|
+ } else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || cap_net_admin)) {
|
|
|
err = -EPERM;
|
|
|
} else if (!try_module_get(ca->owner)) {
|
|
|
err = -EBUSY;
|