diff options
author | Dmitry Yakunin <zeil@yandex-team.ru> | 2020-05-02 18:34:42 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-05-02 16:42:51 -0700 |
commit | ee1bd483cc062d5050f9537064651dd2e06baee7 (patch) | |
tree | e00791a8eeb6b8eecb80434cdcb4eda186552863 /net/ipv4/inet_diag.c | |
parent | f166f890c8f026a931e1bb80f51561a1d2f41b27 (diff) |
inet_diag: bc: read cgroup id only for full sockets
Fix bug introduced by commit b1f3e43dbfac ("inet_diag: add support for
cgroup filter").
Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
Reported-by: syzbot+ee80f840d9bf6893223b@syzkaller.appspotmail.com
Reported-by: syzbot+13bef047dbfffa5cd1af@syzkaller.appspotmail.com
Fixes: b1f3e43dbfac ("inet_diag: add support for cgroup filter")
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_diag.c')
-rw-r--r-- | net/ipv4/inet_diag.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 0034092358c3..125f4f8a36b4 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c @@ -746,7 +746,8 @@ int inet_diag_bc_sk(const struct nlattr *bc, struct sock *sk) else entry.mark = 0; #ifdef CONFIG_SOCK_CGROUP_DATA - entry.cgroup_id = cgroup_id(sock_cgroup_ptr(&sk->sk_cgrp_data)); + entry.cgroup_id = sk_fullsock(sk) ? + cgroup_id(sock_cgroup_ptr(&sk->sk_cgrp_data)) : 0; #endif return inet_diag_bc_run(bc, &entry); |