Subject: Re: [lvc-project] [PATCH] netfilter: ebtables: remove unnecessary NULL check

From: Florian Westphal <[email-masked]>
Date: Wed, 21 Jun 2023 12:46:03 +0200

Igor A. Artemiev <[email-masked]> wrote:
> On 6/20/23 19:38, Florian Westphal wrote:
> > Igor Artemiev <[email-masked]> wrote:
> > > In ebt_do_table() 'private->chainstack' cannot be NULL
> > > and the 'cs' pointer is dereferenced below, so it does not make
> > > sense to compare 'private->chainstack' with NULL.
> > ?  Why do you think that?
> > 
> The 'cs' pointer is dereferenced below without checking, as it is assumed to
> always be initialized with 'private->chainstack[smp_processor_id()]'.

No, its not.  The dereferencing is conditional, as is the allocation
of the chainstack.

No user defined chains, no chain stack.

With this change, "ebtables-legacy -A INPUT" causes kernel panic.