]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
tools: hv: fix checks for origin of netlink message in hv_vss_daemon
authorOlaf Hering <olaf@aepfle.de>
Wed, 24 Apr 2013 14:48:49 +0000 (07:48 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Apr 2013 16:02:35 +0000 (09:02 -0700)
Similar to what commit 95a69adab9acfc3981c504737a2b6578e4d846ef ("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>
tools/hv/hv_vss_daemon.c

index 2a03d0b4e213f0d4a53f87648e30ae8a6eb5ceee..dc3eb1e44c8ab4607653fd91b0e0e079ef86aecb 100644 (file)
@@ -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)