From patchwork Fri Nov 17 12:57:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Arefev X-Patchwork-Id: 166155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp504705vqn; Fri, 17 Nov 2023 04:57:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IF9wMVSlJ0h+PusvD7QmqVwoQmwVu/w2rYvRy22gcLRda2thLBSbp92pMwAh6GvEYpSP6FW X-Received: by 2002:a05:6e02:b45:b0:359:a196:d326 with SMTP id f5-20020a056e020b4500b00359a196d326mr23734592ilu.8.1700225846217; Fri, 17 Nov 2023 04:57:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700225846; cv=none; d=google.com; s=arc-20160816; b=UHvr5XE2QHT1naXRfCccVBtcGjzg/ZrRCpnEXSP+OBNqFWFDhjDRlow0iQ+tJGf1+l a7D51wcu62blBnEosMYD0BdXvhQn0al+CMbuAz/TJTtbrWXWM6Qnx82RMipEXxsuIJ/f S6hx3j5tvlMfP3bDBC1j8KkZvOLYM9lnmLmdBfZ7lVkmD25t0eO4HDZXsgVjDQx5ydh3 3EeS167tTINQDBUZRGNGYxvAiDH5KT9Lsgp3H4drz3ZmqE3it8LEwXdO264JCjrisaJ4 byUEYRX3YOyH5mtoVzOhLxP7pueZFfPagYWHIF2ToPmrlb0fi44kx0jGELOqcjoXGL3a L/wA== 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:dkim-signature:from; bh=yZD/Sn1R2SVTne1HGGZ4hKTypVy6dTpTjai+r/elyT4=; fh=P/RQfKjOhNs7ABLLXVaJjAQ7olxvoGqD6PM9QdH06Wo=; b=naiI4C1ADju1BZBU4WZ116+bQZdSOPPzhhu104y/ekRvY+XNgmktAMS6+fBvOMkbHg 6Q//osUREyh0/gjpvFrnB611pqRtpHik1JDjEW58+mheBM7FmZz8HBrMDxClPnacmy5e zGhSHrfDTR28t+iRh/UNa6SSN4Oyp2Rdi7cf/zZISUJOyC9c/QlSpNbx7iDO03GuPj8Y 4PCKO36gLmPJkdyDw/z9Fh1refkTgA+QPYqmK4LR31K+UkB80H8ycHNIdM3lxEr5whLC efRdI7ASYwzDuCuAxdCWrEOgqAMkLGoBhy5nN4PNUR4sJKhZHRAFx2sxsDFoboVJmhDU rKFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=voctcqkI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id n189-20020a6327c6000000b005c1c5d338a9si1947430pgn.658.2023.11.17.04.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 04:57:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=voctcqkI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id E40F782429A8; Fri, 17 Nov 2023 04:57:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345851AbjKQM5N (ORCPT + 30 others); Fri, 17 Nov 2023 07:57:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbjKQM5L (ORCPT ); Fri, 17 Nov 2023 07:57:11 -0500 Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05820D5F for ; Fri, 17 Nov 2023 04:57:06 -0800 (PST) From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1700225821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=yZD/Sn1R2SVTne1HGGZ4hKTypVy6dTpTjai+r/elyT4=; b=voctcqkI8M3/osfELiL5uRL72hNMig0TDFR1ZR7+xmlj6OJObqtE8LUvi3Qzglfs5uHBl8 LXIe0hTkwSfX6uE4GncVWtF+JtUvwhSrxrJat6y1cVbAtjpajoljkFtpQ3Q4LBOQqC1y8D fGrIKupsOn6duLlxjhLty6v8vm6ONGI= To: Louis Peens Cc: Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , oss-drivers@corigine.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] nfp: flower: Added pointer check and continue. Date: Fri, 17 Nov 2023 15:57:01 +0300 Message-Id: <20231117125701.58927-1-arefev@swemel.ru> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 17 Nov 2023 04:57:23 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782816016467853798 X-GMAIL-MSGID: 1782816016467853798 Return value of a function 'kmalloc_array' is dereferenced at lag_conf.c without checking for null, but it is usually checked for this function. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Denis Arefev --- 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 88d6d992e7d0..8cc6cce73283 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c @@ -339,6 +339,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 * work queue triggering. If the number of slaves has changed