aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix
diff options
context:
space:
mode:
Diffstat (limited to 'net/unix')
-rw-r--r--net/unix/diag.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/net/unix/diag.c b/net/unix/diag.c
index 83799ef19b49..0e0fda786afe 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -43,6 +43,26 @@ rtattr_failure:
43 return -EMSGSIZE; 43 return -EMSGSIZE;
44} 44}
45 45
46static int sk_diag_dump_peer(struct sock *sk, struct sk_buff *nlskb)
47{
48 struct sock *peer;
49 int ino;
50
51 peer = unix_peer_get(sk);
52 if (peer) {
53 unix_state_lock(peer);
54 ino = sock_i_ino(peer);
55 unix_state_unlock(peer);
56 sock_put(peer);
57
58 RTA_PUT_U32(nlskb, UNIX_DIAG_PEER, ino);
59 }
60
61 return 0;
62rtattr_failure:
63 return -EMSGSIZE;
64}
65
46static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_req *req, 66static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_req *req,
47 u32 pid, u32 seq, u32 flags, int sk_ino) 67 u32 pid, u32 seq, u32 flags, int sk_ino)
48{ 68{
@@ -69,6 +89,10 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_r
69 sk_diag_dump_vfs(sk, skb)) 89 sk_diag_dump_vfs(sk, skb))
70 goto nlmsg_failure; 90 goto nlmsg_failure;
71 91
92 if ((req->udiag_show & UDIAG_SHOW_PEER) &&
93 sk_diag_dump_peer(sk, skb))
94 goto nlmsg_failure;
95
72 nlh->nlmsg_len = skb_tail_pointer(skb) - b; 96 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
73 return skb->len; 97 return skb->len;
74 98