summaryrefslogtreecommitdiff
path: root/net/ipv4/raw_diag.c
diff options
context:
space:
mode:
authorDmitry Yakunin <zeil@yandex-team.ru>2020-03-05 15:33:12 +0300
committerDavid S. Miller <davem@davemloft.net>2020-03-09 07:57:48 +0300
commit83f73c5bb7b9a9135173f0ba2b1aa00c06664ff9 (patch)
tree39c21636cd4bb6e1b44bab7034c030d9c3705195 /net/ipv4/raw_diag.c
parentb723bd933980f4956dabc8a8d84b3e83be8d094c (diff)
downloadlinux-83f73c5bb7b9a9135173f0ba2b1aa00c06664ff9.tar.xz
inet_diag: return classid for all socket types
In commit 1ec17dbd90f8 ("inet_diag: fix reporting cgroup classid and fallback to priority") croup classid reporting was fixed. But this works only for TCP sockets because for other socket types icsk parameter can be NULL and classid code path is skipped. This change moves classid handling to inet_diag_msg_attrs_fill() function. Also inet_diag_msg_attrs_size() helper was added and addends in nlmsg_new() were reordered to save order from inet_sk_diag_fill(). Fixes: 1ec17dbd90f8 ("inet_diag: fix reporting cgroup classid and fallback to priority") Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru> Reviewed-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/raw_diag.c')
-rw-r--r--net/ipv4/raw_diag.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/raw_diag.c b/net/ipv4/raw_diag.c
index e35736b99300..a93e7d1e1251 100644
--- a/net/ipv4/raw_diag.c
+++ b/net/ipv4/raw_diag.c
@@ -100,8 +100,9 @@ static int raw_diag_dump_one(struct sk_buff *in_skb,
if (IS_ERR(sk))
return PTR_ERR(sk);
- rep = nlmsg_new(sizeof(struct inet_diag_msg) +
- sizeof(struct inet_diag_meminfo) + 64,
+ rep = nlmsg_new(nla_total_size(sizeof(struct inet_diag_msg)) +
+ inet_diag_msg_attrs_size() +
+ nla_total_size(sizeof(struct inet_diag_meminfo)) + 64,
GFP_KERNEL);
if (!rep) {
sock_put(sk);