From: Thomas Haller <thaller@redhat.com>
To: NetFilter <netfilter-devel@vger.kernel.org>
Cc: Thomas Haller <thaller@redhat.com>
Subject: [PATCH nft 1/1] cache: avoid accessing uninitialized varible in implicit_chain_cache()
Date: Fri, 8 Sep 2023 19:13:27 +0200 [thread overview]
Message-ID: <20230908171329.1175287-1-thaller@redhat.com> (raw)
$ ./tests/shell/run-tests.sh -V tests/shell/testcases/cache/0010_implicit_chain_0
Gives:
==59== Conditional jump or move depends on uninitialised value(s)
==59== at 0x48A6A6B: mnl_nft_rule_dump (mnl.c:695)
==59== by 0x48778EA: rule_cache_dump (cache.c:664)
==59== by 0x487797D: rule_init_cache (cache.c:997)
==59== by 0x4877ABF: implicit_chain_cache.isra.0 (cache.c:1032)
==59== by 0x48785C9: cache_init_objects (cache.c:1132)
==59== by 0x48785C9: nft_cache_init (cache.c:1166)
==59== by 0x48785C9: nft_cache_update (cache.c:1224)
==59== by 0x48ADBE1: nft_evaluate (libnftables.c:530)
==59== by 0x48AEC29: nft_run_cmd_from_buffer (libnftables.c:596)
==59== by 0x402983: main (main.c:535)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/cache.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/cache.c b/src/cache.c
index 3fe6bb407796..4e89fe1338f3 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1027,8 +1027,10 @@ static int implicit_chain_cache(struct netlink_ctx *ctx, struct table *table,
int ret = 0;
list_for_each_entry(chain, &table->chain_bindings, cache.list) {
- filter.list.table = table->handle.table.name;
- filter.list.chain = chain->handle.chain.name;
+ filter.list = (typeof(filter.list)) {
+ .table = table->handle.table.name,
+ .chain = chain->handle.chain.name,
+ };
ret = rule_init_cache(ctx, table, &filter);
}
--
2.41.0
reply other threads:[~2023-09-08 17:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230908171329.1175287-1-thaller@redhat.com \
--to=thaller@redhat.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).