Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2622954rwl; Mon, 27 Mar 2023 02:58:41 -0700 (PDT) X-Google-Smtp-Source: AKy350a+Bpq1I59P80EmXZuXfMSswFuzuDHZVhglXCzfhThXfNETWxyOB/JZyrO+i3SzYyfZ4FLa X-Received: by 2002:a17:90b:1b0a:b0:23d:2532:ae34 with SMTP id nu10-20020a17090b1b0a00b0023d2532ae34mr9922799pjb.2.1679911121567; Mon, 27 Mar 2023 02:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679911121; cv=none; d=google.com; s=arc-20160816; b=S47XKk3RZVqWyyZQpW0JrJacWvWyMqr9y4oMwbYyWdHvOaprln9RDxkqDG5HkyaEt7 sekb7/VH10Hp2QRothOpmzTkwAq+Nt0hdgIatpuTXBqTVUF7aBSMDzhWCuSA4MiDdCme slpAJUkPSfN9Pw5SYJchOPfwGpHwHVJ+GT4P5xrHeELTMPC1oCsVtdlZ4xtZ4KMqIjNb UaXm4tfVw6t2nNgGJ85rIlGgr/6/ccoqSvBwo/UAf8UKTyQuNq9wyP8gDzTTDvrgPSPH ThNDCZy4wA3VIZZ7/DGyEQxzR4tI8y7UTyRKIgJRxYc9WYRbdxMZBVokHOUQGsHqTLNX ejYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=KcdDTbGgFOsGV3EsS6GPwVavTOXKPYqKVe+yAZuLZhI=; b=Ba+ubPBIZN9jZLgVFVqRp6A/CVJoIWv+vGLfzP6+SOiUXR1PlzUVW7aDMGTeCLigaf E7veo+ASR2jHfEzmLbypnwMUw6TarcAAiIHCp04/Jmc9YvbrhUPB5kUYmR8w7CbSgvjR pOwrSiy5Ur6olS47zASNuysM6bzyNYBlJMeLAxfWA17QEredYszYsWvckordghGB2sEc Jx7qgEZghJAbqiDfJrRBBmcTWEKuPw/yshYtMRTJXxpmABuY8oyeIPcM2tl11Pou2+TN qWMv7Q4paehP8AD7nubYL2iXHbvCA/ID55ppw4LL61NaxRq+1VjmlYZop1jCiSWiRg2H WXUw== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mcst.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iy9-20020a170903130900b0019ceb9491d2si26352450plb.391.2023.03.27.02.58.29; Mon, 27 Mar 2023 02:58:41 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mcst.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233259AbjC0J6M (ORCPT + 99 others); Mon, 27 Mar 2023 05:58:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233105AbjC0J6L (ORCPT ); Mon, 27 Mar 2023 05:58:11 -0400 X-Greylist: delayed 601 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 27 Mar 2023 02:58:04 PDT Received: from tretyak2.mcst.ru (tretyak2.mcst.ru [212.5.119.215]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 087C549EC; Mon, 27 Mar 2023 02:58:03 -0700 (PDT) Received: from tretyak2.mcst.ru (localhost [127.0.0.1]) by tretyak2.mcst.ru (Postfix) with ESMTP id 72344102376; Mon, 27 Mar 2023 12:42:22 +0300 (MSK) Received: from frog.lab.sun.mcst.ru (frog.lab.sun.mcst.ru [172.16.4.50]) by tretyak2.mcst.ru (Postfix) with ESMTP id 6CCD110238E; Mon, 27 Mar 2023 12:41:27 +0300 (MSK) Received: from artemiev-i.lab.sun.mcst.ru (avior-1 [192.168.53.223]) by frog.lab.sun.mcst.ru (8.13.4/8.12.11) with ESMTP id 32R9fQFV020930; Mon, 27 Mar 2023 12:41:26 +0300 From: Igor Artemiev To: Pablo Neira Ayuso Cc: Igor Artemiev , 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: [lvc-project] [PATCH] netfilter: nfnetlink: NULL-check skb->dev in __build_packet_message() Date: Mon, 27 Mar 2023 12:41:16 +0300 Message-Id: <20230327094116.1763201-1-Igor.A.Artemiev@mcst.ru> X-Mailer: git-send-email 2.39.0.152.ga5737674b6 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Anti-Virus: Kaspersky Anti-Virus for Linux Mail Server 5.6.39/RELEASE, bases: 20111107 #2745587, check: 20230327 notchecked X-AV-Checked: ClamAV using ClamSMTP 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 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)) { 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