aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2019-11-15 15:26:31 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-11-15 15:58:48 +0100
commitcdac920beb540736200639a6254e6dc01422e705 (patch)
treecd81db4cf8fc9f1879f46e6409241066a2b3d191 /executor
parent90f3b019e42736360b0f1fcfcda486086b07c9a1 (diff)
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 <dvyukov@google.com> Fixes: f350e2dc1f59 ("executor: rename devlink port netdevices to defined names") Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Diffstat (limited to 'executor')
-rw-r--r--executor/common_linux.h4
1 files changed, 4 insertions, 0 deletions
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) {