Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2380410lqp; Sun, 24 Mar 2024 16:51:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUao6P2g3DMJuhDqbvWNnzwWAYHFI/OY+qTUoWKnvKTSagKQglwvDhERRBpdaqO5Q20NBCBg7vCXqFuKVXY+O35SMqLxv2RMLrNJDD8LQ== X-Google-Smtp-Source: AGHT+IEeOYx0q442R8TPkFhiv09rPCwkD4SuOJwH+EI786Z9w+dKAtzIpmuGjusBe/ka6CBviNII X-Received: by 2002:a05:6122:2513:b0:4d3:cff6:79f0 with SMTP id cl19-20020a056122251300b004d3cff679f0mr2705660vkb.4.1711324293635; Sun, 24 Mar 2024 16:51:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711324293; cv=pass; d=google.com; s=arc-20160816; b=WFdZGpEaMKtBAiGItw9KKxpcGi30A+lKhqH+zVi7NLYdcIxhAZo0keRgPB8OsMyYeE vgo7oAy98PR6pRT931IGBylfzknN1VPHF0vlVoydaPHGUwYzxoisJLMTgP3vg0eLW+ox JIT7QT1LrMkLaFc1J+YpdbxUcE5nBtJlHXsb7fCxGdnn4WeHy962f4ikDZXvBfgQQL/u x7VvnKqiCo3Mr1LQltCyHnBRPObpWRd/QC05iLTjxSWGen8KNqc0A0XTDGDCiT9Xb7IG IDwMydG2pvXsNKkR3yk8yMR5xdhEmTEok8jwfMsQNGEq+VlFgELi4+TTU6/JsMQFIqAb IIRg== 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=tix5BJBj8Uwy5QNwJAIMjAdXXSdoU+6498cXxlfRvI4=; fh=vyp27HH/OZtPeQ0ihl1CH/7R5Ddvt2TAxweYW4+NmZY=; b=rhPaSc6MJTVPvE258rQGggixl6Tns7H2q5GY0ZF6AI36iLOLFctKoD8+hyQwcnxXuq y/+hU8v7MLcwYu8g57E5xxBtTeumIh5z3ladNj8XJmjhj3stcfWO+VbNrXhCZjqfGj9n mh0E8E72ngj58qcYCF0QixQecaV5N94v92dr1+B8K8jN9YQ/JrlprEbwVovK+5Tjj/tu gMQPsrA1RwzCm2WuaL5OgQ/+tO0aumK2fY3cRzR7SP/4c4AKYfofVth4BArazc+CJHF5 vZv3PZWjjGVjfywO7au1QbxIBBjfWTApcjSzxCj2OecKtHrLGkahcmHy+4knay8/u9V5 syTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i0TWsthv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113236-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113236-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j3-20020a05621419c300b006968f144340si853280qvc.581.2024.03.24.16.51.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:51:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113236-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i0TWsthv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113236-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113236-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 59B591C22ADB for ; Sun, 24 Mar 2024 23:51:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B920183BBE; Sun, 24 Mar 2024 22:40:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i0TWsthv" 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 30F7318432A; Sun, 24 Mar 2024 22:40:36 +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=1711320037; cv=none; b=GjpaXKVCpdlVRz6eU6YU5aeDEZ06d6sX02Tb89TzD8QAsEUD4VdP/gGaNjHN+6cWc21bco/pzYixMK9n+YhlRUcOWtE/JWbaDm0yCz95clzG5yZJzwscd72br/n6kaR1CiUlDUk1/br7kKPc+hY/2YTGy+S0vvK0uoWFrpZWG4A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320037; c=relaxed/simple; bh=PCEyESqUONtKRMCY+7M47ejrQsTEtigs2brUjBJLI5w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IOdNl5WiQmcLsJSod9qRFZLwLGOFcrUkg7uwEr4zFr+/qrqOjX/B9wCZRQMJIf4o9KV8weeanKJHFu5YrWutD4YvtzxQHC4uqLP1nTcRIx1H1eZd8yIkxHMGIcZkhajseEn31KWso9UGIfucTrvHtZrjTjR7Ps4Tg2b3P7aXwZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i0TWsthv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E186C43390; Sun, 24 Mar 2024 22:40:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320036; bh=PCEyESqUONtKRMCY+7M47ejrQsTEtigs2brUjBJLI5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i0TWsthvJPdSzen/rMPbd7sSyC0EbHN/lt/3pZxFRTcSUwLuT13iNsQBxWWZ240ke ZNDNxzrbuUbmct4mjdkQp0yP9W7cLXwZ2gDfvD/S4bwMSK2YPFGRFxMBeA9mYnzzQm fRADRn2cxZqXOX3NThaS5kUcc1ZS2/re+0iTSeAj4D/Ni3JRlZrAI6qq2fzbYyt9le Md63F0gfBdO7n6SK9HQY1y+c2vvoM0u4UrxoIi/yXMGUcRjXLHUXpj4GtBjcmQfIC+ 4nw/d4BIJhUPU3i2nX8UdZN4H/y9w5wNaniUhXFwYUtxxmThit17DTwIOdwt/kNj2t VvVPnaz1OhS0A== 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.8 345/715] nfp: flower: handle acti_netdevs allocation failure Date: Sun, 24 Mar 2024 18:28:44 -0400 Message-ID: <20240324223455.1342824-346-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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 361d7c495e2d8..2c7bd6e80d993 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c @@ -337,6 +337,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