summaryrefslogtreecommitdiff
path: root/net/sctp/sctp_diag.c
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2016-04-24 23:21:22 +0800
committerDavid S. Miller <davem@davemloft.net>2016-04-26 15:18:48 -0400
commitf052f20a825a80c4662dafd3899dddafd4c8f036 (patch)
treec9bb524f2ab289bf5411b844e3e1406d6c2e0e96 /net/sctp/sctp_diag.c
parente96c37f185529d1db4ebc021e4f56822d43945bb (diff)
sctp: sctp_diag should fill RMEM_ALLOC with asoc->rmem_alloc when rcvbuf_policy is set
For sctp assoc, when rcvbuf_policy is set, it will has it's own rmem_alloc, when we dump asoc info in sctp_diag, we should use that value on RMEM_ALLOC as well, just like WMEM_ALLOC. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/sctp_diag.c')
-rw-r--r--net/sctp/sctp_diag.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
index 84829fff3bc9..8e3e769dc9ea 100644
--- a/net/sctp/sctp_diag.c
+++ b/net/sctp/sctp_diag.c
@@ -145,7 +145,11 @@ static int inet_sctp_diag_fill(struct sock *sk, struct sctp_association *asoc,
else
amt = sk_wmem_alloc_get(sk);
mem[SK_MEMINFO_WMEM_ALLOC] = amt;
- mem[SK_MEMINFO_RMEM_ALLOC] = sk_rmem_alloc_get(sk);
+ if (asoc && asoc->ep->rcvbuf_policy)
+ amt = atomic_read(&asoc->rmem_alloc);
+ else
+ amt = sk_rmem_alloc_get(sk);
+ mem[SK_MEMINFO_RMEM_ALLOC] = amt;
mem[SK_MEMINFO_RCVBUF] = sk->sk_rcvbuf;
mem[SK_MEMINFO_SNDBUF] = sk->sk_sndbuf;
mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc;