diff options
author | Olaf Hering <olaf@aepfle.de> | 2012-05-31 10:40:06 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-09 11:29:46 -0400 |
commit | bcc2c9c3fff859e0eb019fe6fec26f9b8eba795c (patch) | |
tree | 7526735de80c573a3319a0f8d0fa6972aad48a59 /tools | |
parent | cfaf025112d3856637ff34a767ef785ef5cf2ca9 (diff) |
Tools: hv: verify origin of netlink connector message
The SuSE security team suggested to use recvfrom instead of recv to be
certain that the connector message is originated from kernel.
CVE-2012-2669
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Marcus Meissner <meissner@suse.de>
Signed-off-by: Sebastian Krahmer <krahmer@suse.de>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/hv/hv_kvp_daemon.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 146fd6147e84..d9834b362943 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c | |||
@@ -701,14 +701,18 @@ int main(void) | |||
701 | pfd.fd = fd; | 701 | pfd.fd = fd; |
702 | 702 | ||
703 | while (1) { | 703 | while (1) { |
704 | struct sockaddr *addr_p = (struct sockaddr *) &addr; | ||
705 | socklen_t addr_l = sizeof(addr); | ||
704 | pfd.events = POLLIN; | 706 | pfd.events = POLLIN; |
705 | pfd.revents = 0; | 707 | pfd.revents = 0; |
706 | poll(&pfd, 1, -1); | 708 | poll(&pfd, 1, -1); |
707 | 709 | ||
708 | len = recv(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0); | 710 | len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0, |
711 | addr_p, &addr_l); | ||
709 | 712 | ||
710 | if (len < 0) { | 713 | if (len < 0 || addr.nl_pid) { |
711 | syslog(LOG_ERR, "recv failed; error:%d", len); | 714 | syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s", |
715 | addr.nl_pid, errno, strerror(errno)); | ||
712 | close(fd); | 716 | close(fd); |
713 | return -1; | 717 | return -1; |
714 | } | 718 | } |