All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: nf_tables: fix loop checking with set element data
Date: Fri, 7 Feb 2014 15:47:34 +0000	[thread overview]
Message-ID: <20140207154720.GA23148@macbook.localnet> (raw)
In-Reply-To: <1391786631-4070-1-git-send-email-pablo@netfilter.org>

On Fri, Feb 07, 2014 at 04:23:51PM +0100, Pablo Neira Ayuso wrote:
> This patch fixes two bugs:
> 
> * Restrict the validation to verdict maps only, since struct nft_data
>   is declared as a union, data[0] may contain the values -3 or -4 which
>   match with NFT_JUMP and NFT_GOTO. I think this will result in crash
>   while performing the chain loop validation.
> 
> * Access to uninitialized data for end interval elements. The element
>   data part is uninitialized in interval end elements.
> 

That's not necessary. The function is only invoked for NFT_DATA_VERDICT.


> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
>  net/netfilter/nf_tables_api.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> index d0c790e3e..522becb 100644
> --- a/net/netfilter/nf_tables_api.c
> +++ b/net/netfilter/nf_tables_api.c
> @@ -2998,6 +2998,11 @@ static int nf_tables_loop_check_setelem(const struct nft_ctx *ctx,
>  					const struct nft_set_iter *iter,
>  					const struct nft_set_elem *elem)
>  {
> +	if (!(set->flags & NFT_SET_MAP) ||
> +	    set->dtype != NFT_DATA_VERDICT ||
> +	    elem->flags & NFT_SET_ELEM_INTERVAL_END)
> +		return 0;
> +
>  	switch (elem->data.verdict) {
>  	case NFT_JUMP:
>  	case NFT_GOTO:
> -- 
> 1.7.10.4

  reply	other threads:[~2014-02-07 15:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07 15:23 [PATCH] netfilter: nf_tables: fix loop checking with set element data Pablo Neira Ayuso
2014-02-07 15:47 ` Patrick McHardy [this message]
2014-02-07 15:51   ` Patrick McHardy
2014-02-07 16:20     ` 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=20140207154720.GA23148@macbook.localnet \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.