diff options
Diffstat (limited to 'net/packet/diag.c')
-rw-r--r-- | net/packet/diag.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/packet/diag.c b/net/packet/diag.c index 533ce4ff108a..92f2c7107eec 100644 --- a/net/packet/diag.c +++ b/net/packet/diag.c | |||
@@ -128,6 +128,7 @@ static int pdiag_put_fanout(struct packet_sock *po, struct sk_buff *nlskb) | |||
128 | 128 | ||
129 | static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, | 129 | static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, |
130 | struct packet_diag_req *req, | 130 | struct packet_diag_req *req, |
131 | bool may_report_filterinfo, | ||
131 | struct user_namespace *user_ns, | 132 | struct user_namespace *user_ns, |
132 | u32 portid, u32 seq, u32 flags, int sk_ino) | 133 | u32 portid, u32 seq, u32 flags, int sk_ino) |
133 | { | 134 | { |
@@ -172,7 +173,8 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, | |||
172 | goto out_nlmsg_trim; | 173 | goto out_nlmsg_trim; |
173 | 174 | ||
174 | if ((req->pdiag_show & PACKET_SHOW_FILTER) && | 175 | if ((req->pdiag_show & PACKET_SHOW_FILTER) && |
175 | sock_diag_put_filterinfo(user_ns, sk, skb, PACKET_DIAG_FILTER)) | 176 | sock_diag_put_filterinfo(may_report_filterinfo, sk, skb, |
177 | PACKET_DIAG_FILTER)) | ||
176 | goto out_nlmsg_trim; | 178 | goto out_nlmsg_trim; |
177 | 179 | ||
178 | return nlmsg_end(skb, nlh); | 180 | return nlmsg_end(skb, nlh); |
@@ -188,9 +190,11 @@ static int packet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
188 | struct packet_diag_req *req; | 190 | struct packet_diag_req *req; |
189 | struct net *net; | 191 | struct net *net; |
190 | struct sock *sk; | 192 | struct sock *sk; |
193 | bool may_report_filterinfo; | ||
191 | 194 | ||
192 | net = sock_net(skb->sk); | 195 | net = sock_net(skb->sk); |
193 | req = nlmsg_data(cb->nlh); | 196 | req = nlmsg_data(cb->nlh); |
197 | may_report_filterinfo = netlink_net_capable(cb->skb, CAP_NET_ADMIN); | ||
194 | 198 | ||
195 | mutex_lock(&net->packet.sklist_lock); | 199 | mutex_lock(&net->packet.sklist_lock); |
196 | sk_for_each(sk, &net->packet.sklist) { | 200 | sk_for_each(sk, &net->packet.sklist) { |
@@ -200,6 +204,7 @@ static int packet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
200 | goto next; | 204 | goto next; |
201 | 205 | ||
202 | if (sk_diag_fill(sk, skb, req, | 206 | if (sk_diag_fill(sk, skb, req, |
207 | may_report_filterinfo, | ||
203 | sk_user_ns(NETLINK_CB(cb->skb).sk), | 208 | sk_user_ns(NETLINK_CB(cb->skb).sk), |
204 | NETLINK_CB(cb->skb).portid, | 209 | NETLINK_CB(cb->skb).portid, |
205 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 210 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |