All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Fernando Fernández Mancera" <ffmancera@riseup.net>
To: Eric Garver <eric@garver.life>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next v2] netfilter: nf_tables: fix possible null-pointer dereference in object update
Date: Fri, 01 Nov 2019 16:01:51 +0100	[thread overview]
Message-ID: <B9925CA6-AC71-4DC4-9519-204244C4AC91@riseup.net> (raw)
In-Reply-To: <20191101144246.22xvyucdocmzyv73@egarver.localdomain>

El 1 de noviembre de 2019 15:42:46 CET, Eric Garver <eric@garver.life> escribió:
>Hi Fernando,
>
>On Wed, Sep 04, 2019 at 02:29:07PM +0200, Fernando Fernandez Mancera
>wrote:
>> Not all objects need an update operation. If the object type doesn't
>implement
>> an update operation and the user tries to update it there will be a
>EOPNOTSUPP
>> error instead of a null pointer.
>> 
>> Fixes: d62d0ba97b58 ("netfilter: nf_tables: Introduce stateful object
>update operation")
>> Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
>> ---
>>  net/netfilter/nf_tables_api.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/net/netfilter/nf_tables_api.c
>b/net/netfilter/nf_tables_api.c
>> index cf767bc58e18..013d28899cab 100644
>> --- a/net/netfilter/nf_tables_api.c
>> +++ b/net/netfilter/nf_tables_api.c
>> @@ -5140,6 +5140,9 @@ static int nf_tables_updobj(const struct
>nft_ctx *ctx,
>>  	struct nft_trans *trans;
>>  	int err;
>>  
>> +	if (!obj->ops->update)
>> +		return -EOPNOTSUPP;
>> +
>>  	trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ,
>>  				sizeof(struct nft_trans_obj));
>>  	if (!trans)
>> -- 
>> 2.20.1
>
>I think this introduced a regression when adding an object that already
>exists:
>
>    # nft add table inet foobar
>    # nft add counter inet foobar my_counter
>    # nft add counter inet foobar my_counter
>    Error: Could not process rule: Operation not supported
>    add counter inet foobar my_counter
>    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>It applies to all objects that don't provide an update handler;
>counter,
>ct helper, ct timeout, ct exception, etc.

Hi Eric,

It seems that you are right. What would be the behaviour here? Resets the object properties?

Thanks Eric!

  reply	other threads:[~2019-11-01 15:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 12:29 [PATCH nf-next v2] netfilter: nf_tables: fix possible null-pointer dereference in object update Fernando Fernandez Mancera
2019-09-05 11:22 ` Pablo Neira Ayuso
2019-11-01 14:42 ` Eric Garver
2019-11-01 15:01   ` Fernando Fernández Mancera [this message]
2019-11-01 15:11     ` Eric Garver
2019-11-01 15:13       ` Fernando Fernández Mancera

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=B9925CA6-AC71-4DC4-9519-204244C4AC91@riseup.net \
    --to=ffmancera@riseup.net \
    --cc=eric@garver.life \
    --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 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.