From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f65.google.com ([209.85.160.65]:44922 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162669AbeCAWnO (ORCPT ); Thu, 1 Mar 2018 17:43:14 -0500 Received: by mail-pl0-f65.google.com with SMTP id w21-v6so4494600plp.11 for ; Thu, 01 Mar 2018 14:43:14 -0800 (PST) From: David Ahern To: stephen@networkplumber.org Cc: u9012063@gmail.com, netdev@vger.kernel.org, chrism@mellanox.com, David Ahern Subject: [PATCH iproute2] libnetlink: __rtnl_talk_iov should only loop max iovlen times Date: Thu, 1 Mar 2018 14:43:08 -0800 Message-Id: <20180301224308.2629-1-dsahern@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 --- 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