Merge tag 'for-linus-4.7-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-block.git] / net / sctp / sctp_diag.c
index bb2d8d9608e95c62d6e0a42ef2a87c1315fb4d6b..8e3e769dc9eafacf3d475c105ee8f39e89adcbcf 100644 (file)
@@ -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;
@@ -161,8 +165,9 @@ static int inet_sctp_diag_fill(struct sock *sk, struct sctp_association *asoc,
        if (ext & (1 << (INET_DIAG_INFO - 1))) {
                struct nlattr *attr;
 
-               attr = nla_reserve(skb, INET_DIAG_INFO,
-                                  sizeof(struct sctp_info));
+               attr = nla_reserve_64bit(skb, INET_DIAG_INFO,
+                                        sizeof(struct sctp_info),
+                                        INET_DIAG_PAD);
                if (!attr)
                        goto errout;