netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft 2/5] src: netlink_delinearize: don't assume element contains a value
Date: Thu, 11 Jan 2018 16:30:21 +0100	[thread overview]
Message-ID: <20180111153024.25198-4-fw@strlen.de> (raw)
In-Reply-To: <20180111153024.25198-1-fw@strlen.de>

We cannot assume i->key->key is EXPR_VALUE, we could look e.g.  at a range,
which will trigger an assertion failure in binop_adjust_one().

We should call __binop_adjust recursively again in the EXPR_SET_ELEM case,
using key as new input.

Fixes: b8b8e7b6ae10 ("evaluate: transfer right shifts to set reference side")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 src/netlink_delinearize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index 2637f4baaec4..655de9e252b8 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -1515,7 +1515,7 @@ static void __binop_adjust(const struct expr *binop, struct expr *right,
 				binop_adjust_one(binop, i->key->right, shift);
 				break;
 			case EXPR_SET_ELEM:
-				binop_adjust_one(binop, i->key->key, shift);
+				__binop_adjust(binop, i->key->key, shift);
 				break;
 			default:
 				BUG("unknown expression type %s\n", i->key->ops->name);
-- 
2.13.6


  parent reply	other threads:[~2018-01-11 15:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 15:30 [nftables] vmap and bit-sized headers Florian Westphal
2018-01-11 15:30 ` [PATCH nft] netlink_linearize: exthdr op must be u32 Florian Westphal
2018-01-15 11:00   ` Pablo Neira Ayuso
2018-01-11 15:30 ` [PATCH nft 1/5] src: segtree: use value expression length Florian Westphal
2018-01-11 15:30 ` Florian Westphal [this message]
2018-01-11 15:30 ` [PATCH nft 3/5] evaluate: handle binop adjustment recursively Florian Westphal
2018-01-11 15:30 ` [PATCH nft 4/5] src: evaluate: add binop transfer support for vmaps Florian Westphal
2018-01-11 15:30 ` [PATCH nft 5/5] tests: add test cases for vmap binop transfer Florian Westphal

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=20180111153024.25198-4-fw@strlen.de \
    --to=fw@strlen.de \
    --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).