diff options
author | Olaf Hering <olaf@aepfle.de> | 2013-04-24 10:48:49 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-24 12:02:35 -0400 |
commit | 5edf5ee42a4dfbc500e9b9531335305d4c81a129 (patch) | |
tree | dca40e1504b4ac1e788d53673182d65aea6a1f5e /tools/hv | |
parent | eb8905b8ff4a887901779504d2ede95dc072bb16 (diff) |
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>
Diffstat (limited to 'tools/hv')
-rw-r--r-- | tools/hv/hv_vss_daemon.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c index 2a03d0b4e213..dc3eb1e44c8a 100644 --- a/tools/hv/hv_vss_daemon.c +++ b/tools/hv/hv_vss_daemon.c | |||
@@ -186,13 +186,19 @@ int main(void) | |||
186 | len = recvfrom(fd, vss_recv_buffer, sizeof(vss_recv_buffer), 0, | 186 | len = recvfrom(fd, vss_recv_buffer, sizeof(vss_recv_buffer), 0, |
187 | addr_p, &addr_l); | 187 | addr_p, &addr_l); |
188 | 188 | ||
189 | if (len < 0 || addr.nl_pid) { | 189 | if (len < 0) { |
190 | syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s", | 190 | syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s", |
191 | addr.nl_pid, errno, strerror(errno)); | 191 | addr.nl_pid, errno, strerror(errno)); |
192 | close(fd); | 192 | close(fd); |
193 | return -1; | 193 | return -1; |
194 | } | 194 | } |
195 | 195 | ||
196 | if (addr.nl_pid) { | ||
197 | syslog(LOG_WARNING, "Received packet from untrusted pid:%u", | ||
198 | addr.nl_pid); | ||
199 | continue; | ||
200 | } | ||
201 | |||
196 | incoming_msg = (struct nlmsghdr *)vss_recv_buffer; | 202 | incoming_msg = (struct nlmsghdr *)vss_recv_buffer; |
197 | 203 | ||
198 | if (incoming_msg->nlmsg_type != NLMSG_DONE) | 204 | if (incoming_msg->nlmsg_type != NLMSG_DONE) |