Skip to content

Commit ee1bd48

Browse files
zeildavem330
authored andcommitted
inet_diag: bc: read cgroup id only for full sockets
Fix bug introduced by commit b1f3e43 ("inet_diag: add support for cgroup filter"). Signed-off-by: Dmitry Yakunin <[email protected]> Reported-by: [email protected] Reported-by: [email protected] Fixes: b1f3e43 ("inet_diag: add support for cgroup filter") Signed-off-by: David S. Miller <[email protected]>
1 parent f166f89 commit ee1bd48

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv4/inet_diag.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,8 @@ int inet_diag_bc_sk(const struct nlattr *bc, struct sock *sk)
746746
else
747747
entry.mark = 0;
748748
#ifdef CONFIG_SOCK_CGROUP_DATA
749-
entry.cgroup_id = cgroup_id(sock_cgroup_ptr(&sk->sk_cgrp_data));
749+
entry.cgroup_id = sk_fullsock(sk) ?
750+
cgroup_id(sock_cgroup_ptr(&sk->sk_cgrp_data)) : 0;
750751
#endif
751752

752753
return inet_diag_bc_run(bc, &entry);

0 commit comments

Comments
 (0)