From cdac920beb540736200639a6254e6dc01422e705 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Fri, 15 Nov 2019 15:26:31 +0100 Subject: executor: consider NLMSG_DONE type in netlink_send_ext() In case the dump is empty, NLMSG_DONE type message is received from kernel right away. Count with this and return 0. Set the reply_len to 0. Reported-by: Dmitry Vyukov Fixes: f350e2dc1f59 ("executor: rename devlink port netdevices to defined names") Signed-off-by: Jiri Pirko --- executor/common_linux.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'executor') diff --git a/executor/common_linux.h b/executor/common_linux.h index 945e0f735..b3d7b8278 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -183,6 +183,10 @@ static int netlink_send_ext(struct nlmsg* nlmsg, int sock, if (n != hdr->nlmsg_len) fail("short netlink write: %d/%d", n, hdr->nlmsg_len); n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); + if (hdr->nlmsg_type == NLMSG_DONE) { + *reply_len = 0; + return 0; + } if (n < sizeof(struct nlmsghdr)) fail("short netlink read: %d", n); if (reply_len && hdr->nlmsg_type == reply_type) { -- cgit mrf-deployment