From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Colin King <colin.king@canonical.com>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
Florian Westphal <fw@strlen.de>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] netfilter: nf_tables: Fix dereference of null pointer flow
Date: Fri, 25 Jun 2021 12:20:21 +0200 [thread overview]
Message-ID: <20210625102021.GA32352@salvia> (raw)
In-Reply-To: <20210625095901.GH2040@kadam>
Hi,
On Fri, Jun 25, 2021 at 12:59:01PM +0300, Dan Carpenter wrote:
> Btw, why is there no clean up if nft_table_validate() fails?
See below.
> net/netfilter/nf_tables_api.c
> 3432 list_add_tail_rcu(&rule->list, &old_rule->list);
> 3433 else
> 3434 list_add_rcu(&rule->list, &chain->rules);
> 3435 }
> 3436 }
> 3437 kvfree(expr_info);
> 3438 chain->use++;
> 3439
> 3440 if (flow)
> 3441 nft_trans_flow_rule(trans) = flow;
> 3442
> 3443 if (nft_net->validate_state == NFT_VALIDATE_DO)
> 3444 return nft_table_validate(net, table);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> The cleanup for this would be quite involved unfortunately... Not
> necessarily something to attempt without being able to test the code.
At this stage, the transaction has been already registered in the
list, and the nf_tables_abort() path takes care of undoing what has
been updated in the preparation phase.
Having said this, Colin patch is correct, it's fixing up the error
path.
next prev parent reply other threads:[~2021-06-25 10:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 19:57 [PATCH][next] netfilter: nf_tables: Fix dereference of null pointer flow Colin King
2021-06-25 9:59 ` Dan Carpenter
2021-06-25 10:20 ` Pablo Neira Ayuso [this message]
2021-06-25 10:33 ` Dan Carpenter
2021-06-25 10:06 ` AW: " Walter Harms
2021-06-25 10:21 ` Pablo Neira Ayuso
2021-07-02 0:56 ` 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=20210625102021.GA32352@salvia \
--to=pablo@netfilter.org \
--cc=colin.king@canonical.com \
--cc=coreteam@netfilter.org \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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).