From: Patrick McHardy <kaber@trash.net>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 1/3] netlink_linearize: fix range cmp instruction generation
Date: Tue, 2 Jun 2015 12:57:39 +0200 [thread overview]
Message-ID: <1433242661-32125-1-git-send-email-kaber@trash.net> (raw)
The LHS expression is generated twice and the register not properly released.
Fix by calling netlink_gen_range() before generating the LHS.
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
src/netlink_linearize.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index 9bef67b..0a0b686 100644
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
@@ -203,6 +203,9 @@ static void netlink_gen_cmp(struct netlink_linearize_ctx *ctx,
assert(dreg == NFT_REG_VERDICT);
+ if (expr->right->ops->type == EXPR_RANGE)
+ return netlink_gen_range(ctx, expr, dreg);
+
sreg = get_register(ctx);
netlink_gen_expr(ctx, expr->left, sreg);
@@ -229,8 +232,6 @@ static void netlink_gen_cmp(struct netlink_linearize_ctx *ctx,
right = expr->right->prefix;
break;
}
- case EXPR_RANGE:
- return netlink_gen_range(ctx, expr, dreg);
default:
right = expr->right;
}
--
2.1.0
next reply other threads:[~2015-06-02 10:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 10:57 Patrick McHardy [this message]
2015-06-02 10:57 ` [PATCH 2/3] ct: add maximum helper length value Patrick McHardy
2015-06-02 10:57 ` [PATCH 3/3] netlink_delinearize: remove obsolete fixme Patrick McHardy
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=1433242661-32125-1-git-send-email-kaber@trash.net \
--to=kaber@trash.net \
--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).