Skip to contentSkip to conversation

libnetlink: __rtnl_talk_iov should only loop max iovlen times

PATCH Applied David Ahern 2 participants 2 messages Mar 1, 2018 – Mar 2, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libnetlink: __rtnl_talk_iov should only loop max iovlen times

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")
---
 lib/libnetlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/libnetlink.c +2 -1
index 7ca47b22581a..8a7efaeb3cd3 100644
@@ -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 &&
Signature · 1 line
2.11.0
#1 lore raw
Quoted 8 lines · On Thu, 1 Mar 2018 14:43:08 -0800 David Ahern <[email protected]> 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")

---

Applied