From: David Ahern <dsahern@gmail.com>
To: stephen@networkplumber.org
Cc: u9012063@gmail.com, netdev@vger.kernel.org, chrism@mellanox.com,
David Ahern <dsahern@gmail.com>
Subject: [PATCH iproute2] libnetlink: __rtnl_talk_iov should only loop max iovlen times
Date: Thu, 1 Mar 2018 14:43:08 -0800 [thread overview]
Message-ID: <20180301224308.2629-1-dsahern@gmail.com> (raw)
William reported ip hanging and bisected to a recent commit for batching
allowing more than 1 command to be sent per message. The loop over
recvmsg should never cycle more than iovlen times -- 1 response for
each command in the message.
Fixes: 72a2ff3916e5 ("lib/libnetlink: Add a new function rtnl_talk_iov")
Signed-off-by: David Ahern <dsahern@gmail.com>
---
lib/libnetlink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 7ca47b22581a..8a7efaeb3cd3 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -670,8 +670,9 @@ static int __rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iov,
free(buf);
if (h->nlmsg_seq == seq)
return 0;
- else
+ else if (i < iovlen)
goto next;
+ return 0;
}
if (rtnl->proto != NETLINK_SOCK_DIAG &&
--
2.11.0
next reply other threads:[~2018-03-01 22:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 22:43 David Ahern [this message]
2018-03-02 21:32 ` [PATCH iproute2] libnetlink: __rtnl_talk_iov should only loop max iovlen times Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180301224308.2629-1-dsahern@gmail.com \
--to=dsahern@gmail.com \
--cc=chrism@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=u9012063@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).