]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
libnetlink: __rtnl_talk_iov should only loop max iovlen times
authorDavid Ahern <dsahern@gmail.com>
Thu, 1 Mar 2018 22:43:08 +0000 (14:43 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 2 Mar 2018 21:30:34 +0000 (13:30 -0800)
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

index 8bb1c8d7d004f84996d24bcad9164ea89d64210b..928de1dd16d84b7802c06d0a659f5d73e1bbcb4b 100644 (file)
@@ -670,8 +670,9 @@ next:
                                                free(buf);
                                        if (h->nlmsg_seq == seq)
                                                return 0;
-                                       else
+                                       else if (i < iovlen)
                                                goto next;
+                                       return 0;
                                }
 
                                if (rtnl->proto != NETLINK_SOCK_DIAG &&