Skip to content

Commit

Permalink
tools: hv: fix checks for origin of netlink message in hv_vss_daemon
Browse files Browse the repository at this point in the history
Similar to what commit 95a69ad ("tools:
hv: Netlink source address validation allows DoS") does in
hv_kvp_daemon, improve checks for origin of netlink connector message.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Olaf Hering authored and Greg Kroah-Hartman committed Apr 24, 2013
1 parent eb8905b commit 5edf5ee
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/hv/hv_vss_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,19 @@ int main(void)
len = recvfrom(fd, vss_recv_buffer, sizeof(vss_recv_buffer), 0,
addr_p, &addr_l);

if (len < 0 || addr.nl_pid) {
if (len < 0) {
syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s",
addr.nl_pid, errno, strerror(errno));
close(fd);
return -1;
}

if (addr.nl_pid) {
syslog(LOG_WARNING, "Received packet from untrusted pid:%u",
addr.nl_pid);
continue;
}

incoming_msg = (struct nlmsghdr *)vss_recv_buffer;

if (incoming_msg->nlmsg_type != NLMSG_DONE)
Expand Down

0 comments on commit 5edf5ee

Please sign in to comment.