netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] libnetlink: __rtnl_talk_iov should only loop max iovlen times
@ 2018-03-01 22:43 David Ahern
  2018-03-02 21:32 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2018-03-01 22:43 UTC (permalink / raw)
  To: stephen; +Cc: u9012063, netdev, chrism, David Ahern

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2] libnetlink: __rtnl_talk_iov should only loop max iovlen times
  2018-03-01 22:43 [PATCH iproute2] libnetlink: __rtnl_talk_iov should only loop max iovlen times David Ahern
@ 2018-03-02 21:32 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2018-03-02 21:32 UTC (permalink / raw)
  To: David Ahern; +Cc: u9012063, netdev, chrism

On Thu,  1 Mar 2018 14:43:08 -0800
David Ahern <dsahern@gmail.com> wrote:

> 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>
> ---

Applied

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-02 21:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-01 22:43 [PATCH iproute2] libnetlink: __rtnl_talk_iov should only loop max iovlen times David Ahern
2018-03-02 21:32 ` Stephen Hemminger

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).