From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C915EB64D7 for ; Wed, 21 Jun 2023 10:48:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231873AbjFUKsM (ORCPT ); Wed, 21 Jun 2023 06:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231915AbjFUKri (ORCPT ); Wed, 21 Jun 2023 06:47:38 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:237:300::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B26281BDF; Wed, 21 Jun 2023 03:46:14 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1qBvLf-0006WT-QB; Wed, 21 Jun 2023 12:46:03 +0200 Date: Wed, 21 Jun 2023 12:46:03 +0200 From: Florian Westphal To: "Igor A. Artemiev" Cc: Florian Westphal , Pablo Neira Ayuso , Jozsef Kadlecsik , "David S . Miller" , Paolo Abeni , Jakub Kicinski , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: Re: [lvc-project] [PATCH] netfilter: ebtables: remove unnecessary NULL check Message-ID: <20230621104603.GA24035@breakpoint.cc> References: <20230620152549.2109063-1-Igor.A.Artemiev@mcst.ru> <20230620163806.GB3799@breakpoint.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Igor A. Artemiev wrote: > On 6/20/23 19:38, Florian Westphal wrote: > > Igor Artemiev 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.