From patchwork Thu Jan 26 13:55:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natalia Petrova X-Patchwork-Id: 1732382 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=ST0jrFnn; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P2mfm6Rzmz23gY for ; Fri, 27 Jan 2023 03:40:48 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 4B8A8409D5; Thu, 26 Jan 2023 16:40:47 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 4B8A8409D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1674751247; bh=oZ5VbgOcV0I2jkNghB190pcFtWDynHADmfjDDZOPIQc=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=ST0jrFnn6WB8OTbag7YYK+DKa0m9rXBi+fJv5koYhwx6MJcisAEeEsqPYfYJ05Iea p90x08tO+A2p9jl/9x5+3asu0QmZCNiHyUtrASj9ehOazCAFGe9iK/2ESt0QFXkaJh pdM/rkHnh1G1B8l3DG5ce8rymFD3XaEjQL/RH9gSt+6n0WpkWkcVPem7JsPzBRwwlc cV09SXoYcE4Pxl8L++ygT5woXc4D9YaYlgUd0MPv65ZGz2n9BK5LYHjNsCWGqu/gPO err7zpKLTB6aS5nnyKzpmSz8upkyQrVLPpiDycWQF0jhfyJ0E43vfTq70qkcsNbM8L +smsZSi1NB37A== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ETmzO6gLEFGG; Thu, 26 Jan 2023 16:40:46 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 5464A409F8; Thu, 26 Jan 2023 16:40:46 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5464A409F8 X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 7C4711BF48D for ; Thu, 26 Jan 2023 13:56:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 55FA94011C for ; Thu, 26 Jan 2023 13:56:23 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 55FA94011C X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t3hBi4qSNwYi for ; Thu, 26 Jan 2023 13:56:22 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6F60940354 Received: from exchange.fintech.ru (exchange.fintech.ru [195.54.195.159]) by smtp2.osuosl.org (Postfix) with ESMTPS id 6F60940354 for ; Thu, 26 Jan 2023 13:56:22 +0000 (UTC) Received: from Ex16-01.fintech.ru (10.0.10.18) by exchange.fintech.ru (195.54.195.169) with Microsoft SMTP Server (TLS) id 14.3.498.0; Thu, 26 Jan 2023 16:56:20 +0300 Received: from KANASHIN1.fintech.ru (10.0.253.125) by Ex16-01.fintech.ru (10.0.10.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Thu, 26 Jan 2023 16:56:20 +0300 From: Natalia Petrova To: , Greg Kroah-Hartman Date: Thu, 26 Jan 2023 16:55:55 +0300 Message-ID: <20230126135555.11407-2-n.petrova@fintech.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230126135555.11407-1-n.petrova@fintech.ru> References: <20230126135555.11407-1-n.petrova@fintech.ru> MIME-Version: 1.0 X-Originating-IP: [10.0.253.125] X-ClientProxiedBy: Ex16-01.fintech.ru (10.0.10.18) To Ex16-01.fintech.ru (10.0.10.18) X-Mailman-Approved-At: Thu, 26 Jan 2023 16:40:41 +0000 Subject: [Intel-wired-lan] [PATCH 5.10 1/1] i40e: Add checking for null for nlmsg_find_attr() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvc-project@linuxtesting.org, intel-wired-lan@lists.osuosl.org, Natalia Petrova , Jesse Brandeburg , linux-kernel@vger.kernel.org, Eric Dumazet , Tony Nguyen , netdev@vger.kernel.org, Jakub Kicinski , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" The result of nlmsg_find_attr() 'br_spec' is dereferenced in nla_for_each_nested(), but it can take null value in nla_find() function, which will result in an error. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 51616018dd1b ("i40e: Add support for getlink, setlink ndo ops") Signed-off-by: Natalia Petrova Reviewed-by: Jesse Brandeburg --- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 53d0083e35da..4626d2a1af91 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -13167,6 +13167,8 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev, } br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); + if (!br_spec) + return -EINVAL; nla_for_each_nested(attr, br_spec, rem) { __u16 mode;