Skip to content

Commit

Permalink
Tools: hv: verify origin of netlink connector message
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Marcus Meissner <[email protected]>
Signed-off-by: Sebastian Krahmer <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
olafhering authored and gregkh committed Jun 9, 2012
1 parent cfaf025 commit bcc2c9c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/hv/hv_kvp_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,14 +701,18 @@ int main(void)
pfd.fd = fd;

while (1) {
struct sockaddr *addr_p = (struct sockaddr *) &addr;
socklen_t addr_l = sizeof(addr);
pfd.events = POLLIN;
pfd.revents = 0;
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) {
syslog(LOG_ERR, "recv failed; error:%d", len);
if (len < 0 || addr.nl_pid) {
syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s",
addr.nl_pid, errno, strerror(errno));
close(fd);
return -1;
}
Expand Down

0 comments on commit bcc2c9c

Please sign in to comment.