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>
This commit is contained in:
parent
cfaf025112
commit
bcc2c9c3ff
1 changed files with 7 additions and 3 deletions
|
@ -701,14 +701,18 @@ int main(void)
|
||||||
pfd.fd = fd;
|
pfd.fd = fd;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
struct sockaddr *addr_p = (struct sockaddr *) &addr;
|
||||||
|
socklen_t addr_l = sizeof(addr);
|
||||||
pfd.events = POLLIN;
|
pfd.events = POLLIN;
|
||||||
pfd.revents = 0;
|
pfd.revents = 0;
|
||||||
poll(&pfd, 1, -1);
|
poll(&pfd, 1, -1);
|
||||||
|
|
||||||
len = recv(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0);
|
len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0,
|
||||||
|
addr_p, &addr_l);
|
||||||
|
|
||||||
if (len < 0) {
|
if (len < 0 || addr.nl_pid) {
|
||||||
syslog(LOG_ERR, "recv failed; error:%d", len);
|
syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s",
|
||||||
|
addr.nl_pid, errno, strerror(errno));
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue