Skip to content

Commit 5edf5ee

Browse files
olafheringgregkh
authored andcommitted
tools: hv: fix checks for origin of netlink message in hv_vss_daemon
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>
1 parent eb8905b commit 5edf5ee

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎tools/hv/hv_vss_daemon.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,19 @@ int main(void)
186186
len = recvfrom(fd, vss_recv_buffer, sizeof(vss_recv_buffer), 0,
187187
addr_p, &addr_l);
188188

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

196+
if (addr.nl_pid) {
197+
syslog(LOG_WARNING, "Received packet from untrusted pid:%u",
198+
addr.nl_pid);
199+
continue;
200+
}
201+
196202
incoming_msg = (struct nlmsghdr *)vss_recv_buffer;
197203

198204
if (incoming_msg->nlmsg_type != NLMSG_DONE)

0 commit comments

Comments
 (0)