Skip to content

Commit

Permalink
inet_diag: bc: read cgroup id only for full sockets
Browse files Browse the repository at this point in the history
Fix bug introduced by commit b1f3e43 ("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: b1f3e43 ("inet_diag: add support for cgroup filter")
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dmitry Yakunin authored and David S. Miller committed May 2, 2020
1 parent f166f89 commit ee1bd48
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ipv4/inet_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ee1bd48

Please sign in to comment.