Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2566274lqp; Mon, 25 Mar 2024 02:50:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbi8ZKN7Sd3aNjtiFTKETlFDSkZ3fs2hupKd8CLmehfw1zp+bktaHVkdMe9z+5REjSjz+F/jAK/rWCpy8OM77UjfI2sWuGOrTgpBBquw== X-Google-Smtp-Source: AGHT+IEyujzNvpRVDwzEuRFMpXs56ArU/hWS9c17HRNiffLG5m0Tm2tXsQDXRDWRgW3RRnYerqgl X-Received: by 2002:a17:907:7e92:b0:a47:5182:557b with SMTP id qb18-20020a1709077e9200b00a475182557bmr3981000ejc.7.1711360258262; Mon, 25 Mar 2024 02:50:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711360258; cv=pass; d=google.com; s=arc-20160816; b=aFC4nY1SfefhOzG/moGN4G+HxImjp/fv0oOvIcgi04GbL+Kq82QA9ombbxcL096JLD mQDHs1BLp8nYUZqOPFFZ7OVu8J7Pk3k5HGevnv0NYnM1y2tAPST3dvpnt1xuzv7/djCg 4kecDnQNT/5K8XSloHUh40NE96HY48Xn1lnUFO9/IOdkNjR+pfUhllseyLU55Cqbw9bC d991S2u4IeEXHnp/8CWPWm84jTyfPVTVHFZjJhrjfVumbjVXv5vakJu36XzbdBXRcJEb 3SiJ6BIYmFrJWV5govl1oWzj+kVh1MAQzyCYIUbEZH8k6prSnf4RGR2pfAYVnBLYodet 2GsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=I+tX+wBQ7GBlQA5IyVaQidloh7dq023i/sS2OoAb9lM=; fh=vyp27HH/OZtPeQ0ihl1CH/7R5Ddvt2TAxweYW4+NmZY=; b=S7qoAJpEG2vkQEw2C9aQxdxEf+2NWyvwDrwgh3urqsV0YtUUc3/UWpizGgooH6uwiZ zaSF/ZIKEJKcKTCoG6I8r5L1DhFXwnj2CfKe8FLSG4po+35odias0QyQt+zpQ68pigfH W2IIqbp/RGXcO3Lk9EALnjLKgGk56dqKQod4lg6NLDenoJIU4Ee7Na2kkNMkp7kzTaCq Lf3U/ugCcomuOhfyCKnNazss3y25z41kv0FlbMiI12t7XAgpB8l5ssKiXCSW4NZAdtAh QaHWoM3wM9DZxk0GguigvTqOVgrGZbZJuAx2K6hcsIDXlNU7joWQjKDw1P3bnglANdNA XFdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pa9VHCWp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115940-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115940-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qb17-20020a1709077e9100b00a473e26f093si2348270ejc.396.2024.03.25.02.50.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:50:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115940-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pa9VHCWp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115940-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115940-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 045AA1F2AFED for ; Mon, 25 Mar 2024 09:50:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 75E4E38EF37; Mon, 25 Mar 2024 03:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Pa9VHCWp" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A78522AB97; Sun, 24 Mar 2024 23:15:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322154; cv=none; b=bn3exQPSH6b1PhMZpmT8ZYKOmAr0/+x4G9MTWe9CMKcNh3tXunhDjKp67wA7JdoV9fzEf/Ux7+c2Jad51Y9o7AsvLC7RHOJproUWWwCLynF7OnsNY8xIpwu8zpYEbZ+cZkNHEw967SipF8TB9S4beaJ7gyMvHlgbR5p7toHUhHQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322154; c=relaxed/simple; bh=gwobMM9/9qbaSInsdF01UBeLUAeQfgP6FuCZ2TJ+iXo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MO9a7+p0P3RPdYMmZfQPMxEotCPAOqQ73Kaa7dHvSApjOmmARplYYXIYNZk4LW5LOzBronH4s4WMI4Qg/kahbOWxMksthiB2G+EgUFO9KBDJ4lHTEmNNPeDhoupJvaG3boo6iTn4sSU5zcSPS1T3WuPgC25hJqqreG2/uX+kP6A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Pa9VHCWp; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34280C433B2; Sun, 24 Mar 2024 23:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322152; bh=gwobMM9/9qbaSInsdF01UBeLUAeQfgP6FuCZ2TJ+iXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pa9VHCWp7xTj+B1GvCAGGdzLmHCRtfC/Sfl3nBUKmsJIqKoE0bvRwJAYbHqZO1DYf kVifqG+0nqKO7qwTxtxaaOpP7fZBwMU60wMkIP3dQWvjj6Z4vcx8wEhIi2EVqeBY70 JO2YJKlyE5sQYgjUz3MKuP95M53nVMXxZdCp6rCI8rCOH9JTO8vw6JtfG5/MKIU4rd rE+QVfw/OwfA8Pj72QzDaRYRI9aWle5B4BatwaxgCMC1paK1kcFoL/Yt/RdpzLYm1C OOeBdIxThjsbSDqf/oUEly3v5FL87Ia4BoyXVbp+XuEUAGtn4G89c3DunBjSkjVwZi zUgtusRNUDqhA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Duoming Zhou , Louis Peens , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 230/451] nfp: flower: handle acti_netdevs allocation failure Date: Sun, 24 Mar 2024 19:08:26 -0400 Message-ID: <20240324231207.1351418-231-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Duoming Zhou [ Upstream commit 84e95149bd341705f0eca6a7fcb955c548805002 ] The kmalloc_array() in nfp_fl_lag_do_work() will return null, if the physical memory has run out. As a result, if we dereference the acti_netdevs, the null pointer dereference bugs will happen. This patch adds a check to judge whether allocation failure occurs. If it happens, the delayed work will be rescheduled and try again. Fixes: bb9a8d031140 ("nfp: flower: monitor and offload LAG groups") Signed-off-by: Duoming Zhou Reviewed-by: Louis Peens Link: https://lore.kernel.org/r/20240308142540.9674-1-duoming@zju.edu.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/netronome/nfp/flower/lag_conf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c b/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c index e92860e20a24a..c6a2c302a8c8b 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c @@ -308,6 +308,11 @@ static void nfp_fl_lag_do_work(struct work_struct *work) acti_netdevs = kmalloc_array(entry->slave_cnt, sizeof(*acti_netdevs), GFP_KERNEL); + if (!acti_netdevs) { + schedule_delayed_work(&lag->work, + NFP_FL_LAG_DELAY); + continue; + } /* Include sanity check in the loop. It may be that a bond has * changed between processing the last notification and the -- 2.43.0