Skip to content

Commit 1b0fa10

Browse files
matttbeintel-lab-lkp
authored andcommitted
tcp: ulp: diag: remove net admin restriction
Since its introduction in commit 61723b3 ("tcp: ulp: add functions to dump ulp-specific information"), the ULP diag info have been exported only if the requester had CAP_NET_ADMIN. It looks like there is nothing sensitive being exported here by the MPTCP and KTLS layers. So it seems safe to remove this restriction in order to ease the debugging from the userspace side without requiring additional capabilities. Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent 1238896 commit 1b0fa10

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

net/ipv4/tcp_diag.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ static int tcp_diag_get_aux(struct sock *sk, bool net_admin,
113113
struct sk_buff *skb)
114114
{
115115
struct inet_connection_sock *icsk = inet_csk(sk);
116+
const struct tcp_ulp_ops *ulp_ops;
116117
int err = 0;
117118

118119
#ifdef CONFIG_TCP_MD5SIG
@@ -129,15 +130,13 @@ static int tcp_diag_get_aux(struct sock *sk, bool net_admin,
129130
}
130131
#endif
131132

132-
if (net_admin) {
133-
const struct tcp_ulp_ops *ulp_ops;
134-
135-
ulp_ops = icsk->icsk_ulp_ops;
136-
if (ulp_ops)
137-
err = tcp_diag_put_ulp(skb, sk, ulp_ops);
138-
if (err)
133+
ulp_ops = icsk->icsk_ulp_ops;
134+
if (ulp_ops) {
135+
err = tcp_diag_put_ulp(skb, sk, ulp_ops);
136+
if (err < 0)
139137
return err;
140138
}
139+
141140
return 0;
142141
}
143142

@@ -164,7 +163,7 @@ static size_t tcp_diag_get_aux_size(struct sock *sk, bool net_admin)
164163
}
165164
#endif
166165

167-
if (net_admin && sk_fullsock(sk)) {
166+
if (sk_fullsock(sk)) {
168167
const struct tcp_ulp_ops *ulp_ops;
169168

170169
ulp_ops = icsk->icsk_ulp_ops;

0 commit comments

Comments
 (0)