netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/3] netfilter: nf_tables: check for overflow of rule dlen field
Date: Thu, 5 Mar 2015 17:31:27 +0100	[thread overview]
Message-ID: <20150305163127.GA6878@salvia> (raw)
In-Reply-To: <1425413060-6187-3-git-send-email-kaber@trash.net>

On Tue, Mar 03, 2015 at 08:04:19PM +0000, Patrick McHardy wrote:
> Check that the space required for the expressions doesn't exceed the
> size of the dlen field, which would lead to the iterators crashing.
> 
> Signed-off-by: Patrick McHardy <kaber@trash.net>
> ---
>  net/netfilter/nf_tables_api.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> index 6fb532b..7baafd5 100644
> --- a/net/netfilter/nf_tables_api.c
> +++ b/net/netfilter/nf_tables_api.c
> @@ -1968,6 +1968,10 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb,
>  			n++;
>  		}
>  	}
> +	/* Check for overflow of dlen field */
> +	err = -EFBIG;

Should we use -EOVERFLOW instead as we use in other nf_tables spots?

The error in userspace will be: "Value too large for defined data type".

> +	if (size >= 1 << 12)
> +		goto err1;
>  
>  	if (nla[NFTA_RULE_USERDATA])
>  		ulen = nla_len(nla[NFTA_RULE_USERDATA]);
> -- 
> 2.1.0
> 

  reply	other threads:[~2015-03-05 16:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 20:04 [PATCH 0/3] netfilter: nf_tables fixes Patrick McHardy
2015-03-03 20:04 ` [PATCH 1/3] netfilter: nf_tables: fix transaction race condition Patrick McHardy
2015-03-04 16:18   ` Pablo Neira Ayuso
2015-03-04 16:26     ` Patrick McHardy
2015-03-04 17:01       ` Pablo Neira Ayuso
2015-03-04 17:03         ` Patrick McHardy
2015-03-04 17:28           ` Pablo Neira Ayuso
2015-03-04 17:36             ` Patrick McHardy
2015-03-04 17:38               ` Patrick McHardy
2015-03-03 20:04 ` [PATCH 2/3] netfilter: nf_tables: check for overflow of rule dlen field Patrick McHardy
2015-03-05 16:31   ` Pablo Neira Ayuso [this message]
2015-03-05 16:31     ` Patrick McHardy
2015-03-05 17:11       ` Pablo Neira Ayuso
2015-03-05 17:13         ` Patrick McHardy
2015-03-05 17:42           ` Pablo Neira Ayuso
2015-03-05 18:15             ` Patrick McHardy
2015-03-03 20:04 ` [PATCH 3/3] netfilter: nf_tables: fix userdata length overflow Patrick McHardy
2015-03-05 20:23 ` [PATCH 0/3] netfilter: nf_tables fixes 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=20150305163127.GA6878@salvia \
    --to=pablo@netfilter.org \
    --cc=kaber@trash.net \
    --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).