Commit 77d6a528 authored by Tomas Hozza's avatar Tomas Hozza Committed by Greg Kroah-Hartman

tools: hv: daemon should subscribe only to CN_KVP_IDX group

Previously HyperV daemon set sockaddr_nl.nl_groups to CN_KVP_IDX.
Netlink documentation says: "nl_groups is a bit mask with every bit
representing a netlink group number". Since CN_KVP_IDX value is "9"
HyperV daemon was receiving Netlink messages also from group number
"1" which is used by CGroup Rules Engine Daemon. This caused the
daemon to segfault (at least on 2.6.32 kernel).

HyperV daemon should set nl_groups to zero and specify multicast
group CN_KVP_IDX only by using socket options.
Signed-off-by: default avatarTomas Hozza <thozza@redhat.com>
Acked-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 33349484
...@@ -1443,7 +1443,7 @@ int main(void) ...@@ -1443,7 +1443,7 @@ int main(void)
addr.nl_family = AF_NETLINK; addr.nl_family = AF_NETLINK;
addr.nl_pad = 0; addr.nl_pad = 0;
addr.nl_pid = 0; addr.nl_pid = 0;
addr.nl_groups = CN_KVP_IDX; addr.nl_groups = 0;
error = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); error = bind(fd, (struct sockaddr *)&addr, sizeof(addr));
...@@ -1452,7 +1452,7 @@ int main(void) ...@@ -1452,7 +1452,7 @@ int main(void)
close(fd); close(fd);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
sock_opt = addr.nl_groups; sock_opt = CN_KVP_IDX;
setsockopt(fd, 270, 1, &sock_opt, sizeof(sock_opt)); setsockopt(fd, 270, 1, &sock_opt, sizeof(sock_opt));
/* /*
* Register ourselves with the kernel. * Register ourselves with the kernel.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment