Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2652678rwl; Mon, 27 Mar 2023 03:25:42 -0700 (PDT) X-Google-Smtp-Source: AKy350bipXVKjVU4oO5sJeZBjHXLS5C4MiMW1HAA7Z8IcJcK7XDqNt+H6mGNHvQBHwYfxC7JdfDI X-Received: by 2002:a17:902:c950:b0:19e:b9f8:1fca with SMTP id i16-20020a170902c95000b0019eb9f81fcamr14511922pla.10.1679912742451; Mon, 27 Mar 2023 03:25:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679912742; cv=none; d=google.com; s=arc-20160816; b=Bg6MiOah6etJGVkuwQjxR4pP+m6Yq115GqJuoZRhdKaYuKLaZd0PQFCgN++0wVl63I bP4pOf6yiYcxkZar0nVzamqsQAT3BO5DYS7N3to+K0MJfpIx7BoJTpA9MteqVUytmEI8 N5dSkmTtF/lFTNyKBPDSpV2429Bq3cxGYbMJNmBiuWWHnh35lruYdlXDO55X+J3k4Ecm 4gipvUYtnUGowuZJxh87eDC3w2Dg+qbEbx+9xM8t3SE8HE4B5YrOoJ1M7S9MBCR5WaXe ZKw93oG9+a3fi9aiPVZrqFgd/4TMIRgJmceuAHEMG7DK5X7Sc4WJrIwWf6JEJ6NxzRmj vfcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=OVw9kT7fNXbxcswL1GxtawlVvR3WRYGyM/+uuVCImf4=; b=eG8sYg8JKKNkvl4s2JFLoeCMxr3Ie3ioq9L8wsRNU65nZzQg5GK76IhmcNXixb+62d kLlfOi9frySl7u/VC0nK6LbzTjq5rZTbz3oGg58GU4KTL1jQFEKa5XBajqFZZ8V6CUzG gYuC1zNqZoo8iaKSmM0Um17wkNqUWs7K0Znsa01iXEGbd1XWoaymar/iUFUm6wLUAhNz 5VxXRBJckjicTi77vkIR+nxSCT7RaZgcoNSvCMSMFBDvo9+F1wfor77R9Kxg3nhNjMNH EbnydVTdAYfHB/kAXpRjPsz+4iWr1OehlI9qQ+ukLaQjKCSux29NJBbBuuSp5IilHQmN c9oQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a63dc01000000b004fd10490f3dsi15114034pgg.251.2023.03.27.03.25.31; Mon, 27 Mar 2023 03:25:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233650AbjC0KWv (ORCPT + 99 others); Mon, 27 Mar 2023 06:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233597AbjC0KWn (ORCPT ); Mon, 27 Mar 2023 06:22:43 -0400 Received: from mail.netfilter.org (mail.netfilter.org [217.70.188.207]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 38C165FE8; Mon, 27 Mar 2023 03:22:38 -0700 (PDT) Date: Mon, 27 Mar 2023 12:22:32 +0200 From: Pablo Neira Ayuso To: Igor Artemiev Cc: Jozsef Kadlecsik , Florian Westphal , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [lvc-project] [PATCH] netfilter: nfnetlink: NULL-check skb->dev in __build_packet_message() Message-ID: References: <20230327094116.1763201-1-Igor.A.Artemiev@mcst.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230327094116.1763201-1-Igor.A.Artemiev@mcst.ru> X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 27, 2023 at 12:41:16PM +0300, Igor Artemiev wrote: > After having been compared to NULL value at nfnetlink_log.c:560, > pointer 'skb->dev' is dereferenced at nfnetlink_log.c:576. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Signed-off-by: Igor Artemiev > --- > net/netfilter/nfnetlink_log.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c > index d97eb280cb2e..2711509eb9a5 100644 > --- a/net/netfilter/nfnetlink_log.c > +++ b/net/netfilter/nfnetlink_log.c > @@ -572,7 +572,7 @@ __build_packet_message(struct nfnl_log_net *log, > } > } > > - if (indev && skb_mac_header_was_set(skb)) { > + if (indev && skb->dev && skb_mac_header_was_set(skb)) { This cannot ever happen, we assume skb->dev is always set on. > if (nla_put_be16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type)) || > nla_put_be16(inst->skb, NFULA_HWLEN, > htons(skb->dev->hard_header_len))) > -- > 2.30.2 >