laurenceman / rpms / iptables

Forked from rpms/iptables 5 years ago
Clone

Blame SOURCES/0056-xtables-Catch-errors-when-zeroing-rule-rounters.patch

029dc7
From 4a6f89b263a62f078e73cbc01d09330a217a23c7 Mon Sep 17 00:00:00 2001
029dc7
From: Phil Sutter <phil@nwl.cc>
029dc7
Date: Sat, 15 Dec 2018 19:25:04 +0100
029dc7
Subject: [PATCH] xtables: Catch errors when zeroing rule rounters
029dc7
029dc7
Covscan complained about call to batch_rule_add() not being checked.
029dc7
029dc7
Signed-off-by: Phil Sutter <phil@nwl.cc>
029dc7
Signed-off-by: Florian Westphal <fw@strlen.de>
029dc7
(cherry picked from commit 4c54c892443c20a1d0e1212d541da0e81647058a)
029dc7
Signed-off-by: Phil Sutter <psutter@redhat.com>
029dc7
---
029dc7
 iptables/nft.c | 4 +++-
029dc7
 1 file changed, 3 insertions(+), 1 deletion(-)
029dc7
029dc7
diff --git a/iptables/nft.c b/iptables/nft.c
029dc7
index 4fdc789d99928..2d527358cc7f2 100644
029dc7
--- a/iptables/nft.c
029dc7
+++ b/iptables/nft.c
029dc7
@@ -3218,7 +3218,9 @@ static int __nft_chain_zero_counters(struct nftnl_chain *c, void *data)
029dc7
 			 * rule based on its handle only.
029dc7
 			 */
029dc7
 			nftnl_rule_unset(r, NFTNL_RULE_POSITION);
029dc7
-			batch_rule_add(h, NFT_COMPAT_RULE_REPLACE, r);
029dc7
+			ret = batch_rule_add(h, NFT_COMPAT_RULE_REPLACE, r);
029dc7
+			if (ret)
029dc7
+				return -1;
029dc7
 		}
029dc7
 		r = nftnl_rule_iter_next(iter);
029dc7
 	}
029dc7
-- 
029dc7
2.21.0
029dc7