Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2517097lqp; Mon, 25 Mar 2024 00:44:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXEJQkS0dQDQjCvTdzdHlFXaJjur+D9i25w8/0eMym8K7V011zoM95Ko4J1boHov6hRZx+IrNOoNBoWR9ov0jSfw+zoK5ibnvRK4b01Tw== X-Google-Smtp-Source: AGHT+IGfI2CoHvKwpUpp6LwKqHRO80w+dkPtUWqGUvy44MqkGJ6f+fFjkhy1uUPMGbJGKc/Fq9xU X-Received: by 2002:a05:6870:9891:b0:21e:80ee:523b with SMTP id eg17-20020a056870989100b0021e80ee523bmr4380760oab.34.1711352662252; Mon, 25 Mar 2024 00:44:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711352662; cv=pass; d=google.com; s=arc-20160816; b=ZtHcrraZsISOTzjPQBOXkztFHtJuLJNX1p3icJ1Ieea+Ou2ZFowsbY79QiORbHAbQl vNudrY9UfZ6SGq0MHBGTgRq9eTyvp8Ofg7L9pkqCEYpNy33C3y63Unfbdz8U4wbsMlhe DdqNbi6gBP958sBDzr8E/zBUWd3Rvq2eoik17VKn8/lzTiXy65fHuA7/m/F0E4pPJiK5 i67o8vsbZYRTZpmcdtgXNSAPtwM0lD1tpn9hpHjXkd+G/7hLoGfejzgOCw0dkt2eVmTC fRs5GaT4BjUdrjVhFLJwYNC2AU8Bjn1IgGXeBacY4irKFnRqrSQSKkSF7h/gBDyN7/ik /kdQ== 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=1wwMfo9vynqP4Nbf9uBT3ZCATeWnJBnN7ZPlxSVBGMo=; fh=vyp27HH/OZtPeQ0ihl1CH/7R5Ddvt2TAxweYW4+NmZY=; b=KAWcbqbGtWZufGZTthB9DzJ/UCgAYko5q4f/4946ZJ6PcEuSLsG9HZSMVclKo45fRr Ky4hEY5ZApsbCrzVUHQZ1DNwXrGOhuT8lk+hyd1LkhlVd/GUJsmetKcrPqJzRzT0xRZP Vbwf0jBWUH+DXZGMEnYLSc+drhwP4O3FkH6t/MhOfDDGzTbXayNLfZj6xndRF6PhDvbn G+EHGv+6bdzlx+zQdlvKtukpk57v5tUIkBZ94fyExldfFSOmZeZjAYAljR52OvqPhTrR MyVz8fR05gg3eQH2lvh+gf2JPNwccyH7jRteg0Hx7yyfbF2qm12grepvUJQ/9Wnq/oBE jZ4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Eb0giwWT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114992-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114992-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w187-20020a6262c4000000b006ea700ee5c7si4585015pfb.393.2024.03.25.00.44.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 00:44:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-114992-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Eb0giwWT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114992-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114992-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 22FEFB29C32 for ; Mon, 25 Mar 2024 07:13:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C85B282B64; Mon, 25 Mar 2024 00:58:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Eb0giwWT" 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 5992D282A65; Sun, 24 Mar 2024 23:42:16 +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=1711323737; cv=none; b=E86YUOO096uMYT0wLpZJ0ijcKXDuArCbZtUoyMShvf6c7Ecdp/43Osvxu8XDkEXFLXs46AkOY2PSnW94ehhh2fai0dubEgj5VjX5G2DJCAhYwbLNKCYwzzKLb6ElQocQcTECNywlB8FNg/680zhaqEit1Ykv/OD8wUe0ZYKYDhg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323737; c=relaxed/simple; bh=ir/H48WBd9iJTs/xTH8Oz5/Qn+uxWcc9t3DZeEZ5L6g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ilZAMUKu9FOiXnncUyIqmMLi88cPj9ObkWNGPdwe0BwTMovACP8xfCdUSwgP9rx2EhdiRvOdZxP0a1hPQQ3vyt+pBxcuqmcEKlZZ3DcPpDFQk565TDTQ6TCrNWGYzI9zMCz2q9cVPeC/BrBnfqQ57h3nVu5KSkq6gBaU5we/Lqg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Eb0giwWT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80781C433F1; Sun, 24 Mar 2024 23:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323736; bh=ir/H48WBd9iJTs/xTH8Oz5/Qn+uxWcc9t3DZeEZ5L6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eb0giwWTWOwi77p0b6ZD+ZZu+vlxq/ZEEYvX0V6Ngt+6fWvvNihq9BrPoi/O0Nlf4 /S0K0yR/SJvyKDFx0YUwX8tXl1kXf9Gzw05aNW2lpKj31r+Znz1Z1DSJBH3KhCXcoi MPOFxtPA8e5+lzj3bvstvpnfDEsuPAwOwLybxNGEyCwNcWEmtobSidlSiw0BtscHzI g57m5LtJa/XL7UXL3iZb3fjf0YMf/UGYwNkeMdL1N3/Oq/NpeQI4reBAA2VgbsAjlB IRsyWVCEUG4DvozD3Bv/XX3vg7u96+390fJV2amXLlsrUbMA3c7g9gW+yVAFusqO9M DLXmQ3Od7i5tg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Duoming Zhou , Louis Peens , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 110/238] nfp: flower: handle acti_netdevs allocation failure Date: Sun, 24 Mar 2024 19:38:18 -0400 Message-ID: <20240324234027.1354210-111-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-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 63907aeb3884e..3167f9675ae0f 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