All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Dong Chenchen <dongchenchen2@huawei.com>
Cc: pablo@netfilter.org, kadlec@netfilter.org, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	fw@strlen.de, kuniyu@amazon.com, netfilter-devel@vger.kernel.org,
	netdev@vger.kernel.org, yuehaibing@huawei.com
Subject: Re: [PATCH net v2] net: netfilter: Fix use-after-free in get_info()
Date: Thu, 24 Oct 2024 08:25:19 +0200	[thread overview]
Message-ID: <20241024062519.GA16685@breakpoint.cc> (raw)
In-Reply-To: <20241024014701.2086286-1-dongchenchen2@huawei.com>

Dong Chenchen <dongchenchen2@huawei.com> wrote:
> While xt_table module was going away and has been removed from
> xt_templates list, we couldnt get refcnt of xt_table->me. Check
> module in xt_net->tables list re-traversal to fix it.
> 
> Fixes: fdacd57c79b7 ("netfilter: x_tables: never register tables by default")
> Signed-off-by: Dong Chenchen <dongchenchen2@huawei.com>
> ---
>  net/netfilter/x_tables.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
> index da5d929c7c85..709840612f0d 100644
> --- a/net/netfilter/x_tables.c
> +++ b/net/netfilter/x_tables.c
> @@ -1269,7 +1269,7 @@ struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
>  
>  	/* and once again: */
>  	list_for_each_entry(t, &xt_net->tables[af], list)
> -		if (strcmp(t->name, name) == 0)
> +		if (strcmp(t->name, name) == 0 && owner == t->me)
>  			return t;

LGTM, thanks.

Reviewed-by: Florian Westphal <fw@strlen.de>

  reply	other threads:[~2024-10-24  6:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24  1:47 [PATCH net v2] net: netfilter: Fix use-after-free in get_info() Dong Chenchen
2024-10-24  6:25 ` Florian Westphal [this message]
2024-10-30 11:53 ` 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=20241024062519.GA16685@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=davem@davemloft.net \
    --cc=dongchenchen2@huawei.com \
    --cc=edumazet@google.com \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=yuehaibing@huawei.com \
    /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.