From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [nft PATCH 2/4] netlink: Fix segfault when using --echo flag
Date: Tue, 15 Aug 2017 01:43:03 +0200 [thread overview]
Message-ID: <20170814234305.2829-3-phil@nwl.cc> (raw)
In-Reply-To: <20170814234305.2829-1-phil@nwl.cc>
Commit 07b45939972eb ("src: introduce struct nft_cache") added cache
pointer to struct netlink_mon_handler and the code assumes it is never
NULL. Therefore initialize it in the dummy version of
netlink_mon_handler in netlink_echo_callback().
Fixes: b99c4d072d996 ("Implement --echo option")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
src/netlink.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/netlink.c b/src/netlink.c
index 8aef8d9ab4070..f631c26b2b9ca 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -3075,12 +3075,14 @@ static int netlink_events_cb(const struct nlmsghdr *nlh, void *data)
int netlink_echo_callback(const struct nlmsghdr *nlh, void *data)
{
+ struct netlink_ctx *ctx = data;
struct netlink_mon_handler echo_monh = {
.format = NFTNL_OUTPUT_DEFAULT,
- .ctx = data,
+ .ctx = ctx,
.loc = &netlink_location,
.monitor_flags = 0xffffffff,
.cache_needed = true,
+ .cache = ctx->cache,
};
if (!echo_monh.ctx->octx->echo)
--
2.13.1
next prev parent reply other threads:[~2017-08-14 23:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 23:43 [nft PATCH 0/4] A bunch of fixes for echo output Phil Sutter
2017-08-14 23:43 ` [nft PATCH 1/4] mnl: Drop --echo support for non-batch calls Phil Sutter
2017-08-15 10:25 ` Pablo Neira Ayuso
2017-08-15 11:05 ` Phil Sutter
2017-08-15 11:48 ` Pablo Neira Ayuso
2017-08-14 23:43 ` Phil Sutter [this message]
2017-08-15 10:25 ` [nft PATCH 2/4] netlink: Fix segfault when using --echo flag Pablo Neira Ayuso
2017-08-14 23:43 ` [nft PATCH 3/4] echo: Fix for added delays in rule updates Phil Sutter
2017-08-15 10:35 ` Pablo Neira Ayuso
2017-08-15 11:27 ` Phil Sutter
2017-08-15 11:34 ` Phil Sutter
2017-08-15 11:49 ` Pablo Neira Ayuso
2017-08-14 23:43 ` [nft PATCH 4/4] tests: Merge monitor and echo test suites Phil Sutter
2017-08-15 10:35 ` Pablo Neira Ayuso
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=20170814234305.2829-3-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).