[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <838ab82cacfc5b97282ae10ac9bd96231d57552c.1543939525.git.petrm@mellanox.com>
Date: Tue, 4 Dec 2018 16:07:41 +0000
From: Petr Machata <petrm@...lanox.com>
To: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: [PATCH iproute2 1/2] libnetlink: Process further iovs on no error
When no error is reported in the first iov, do not prematurely return,
but process further iovs. This fixes batch processing.
Fixes: c60389e4f9ea ("libnetlink: fix leak and using unused memory on error")
Signed-off-by: Petr Machata <petrm@...lanox.com>
---
lib/libnetlink.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index c0b80ed..9545710 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -763,6 +763,7 @@ static int __rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iov,
msg.msg_iovlen = 1;
i = 0;
while (1) {
+next:
status = rtnl_recvmsg(rtnl->fd, &msg, &buf);
++i;
@@ -826,6 +827,8 @@ static int __rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iov,
else
free(buf);
+ if (i < iovlen)
+ goto next;
return error ? -i : 0;
}
--
2.4.11
Powered by blists - more mailing lists