Commit 5edf5ee42a4dfbc500e9b9531335305d4c81a129

Authored by Olaf Hering
Committed by Greg Kroah-Hartman
1 parent eb8905b8ff

tools: hv: fix checks for origin of netlink message in hv_vss_daemon

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>

Showing 1 changed file with 7 additions and 1 deletions Side-by-side Diff

tools/hv/hv_vss_daemon.c
... ... @@ -186,11 +186,17 @@
186 186 len = recvfrom(fd, vss_recv_buffer, sizeof(vss_recv_buffer), 0,
187 187 addr_p, &addr_l);
188 188  
189   - if (len < 0 || addr.nl_pid) {
  189 + if (len < 0) {
190 190 syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s",
191 191 addr.nl_pid, errno, strerror(errno));
192 192 close(fd);
193 193 return -1;
  194 + }
  195 +
  196 + if (addr.nl_pid) {
  197 + syslog(LOG_WARNING, "Received packet from untrusted pid:%u",
  198 + addr.nl_pid);
  199 + continue;
194 200 }
195 201  
196 202 incoming_msg = (struct nlmsghdr *)vss_recv_buffer;