Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp891066pxb; Wed, 27 Oct 2021 14:34:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcZIfAnSjaKPzB/5q0fNbIcaZHGZNB1534fm2k2fpLF2ytRzQLaYt36vvA7OzD9Z/sNnVU X-Received: by 2002:a05:6402:40cd:: with SMTP id z13mr532409edb.220.1635370455101; Wed, 27 Oct 2021 14:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370455; cv=none; d=google.com; s=arc-20160816; b=akFW+NO2GW4oBgm/rhw7olT2kYlmsmWmJxaA3Hd+n326SBeykxXigxjB/DZLXbQxl8 +FmWR8YO7aCsfypBs/QW1+DQ4QutHOFemFaUJ8ORDRzCCDbzIpACoYyb4kRujGeAAlbi hvWkDZD7ja6GY3asmLzFBZFGMKIsSvIt2NYDPHURENb8EdvdnT7vhgbRK++LsKYWyL+7 VCswMBhIzC2LBewQga31/oCHLNFSjPva0S8tBbTT31cLk26Xd/eSgyhISo1SJApzP/7m 97Rin1WH4OyxD6vxPH4ACWfaXJCkUO0qEwLrGtxyGBMhWKXBHI+weFm71L1Y6uGxAaNA koBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=L+NlKhelSvgM9MtD5+jKKXS80K0DFKDQ+yOpHQYMv3w=; b=O2lKnPlgXPJH/lI9UquiaSjw+x7RVbX9IB6AsBfqvtacBc8jTA89p/usHR9WUN4FBC ScS1XxNZ0w+LnCo5S1uBR74L964hVkvnmD/MB8TMRyE4/DpgPxCFlBOro/4URg3U3Icq 4XQic7mrWXWkn5o4ajZDQ0arrUNKSuLHEJwsThr8+kvBZcXS6aplyS0YeU7TdfqK4CU7 j8dPLeDB+yWNQYrQMtezsrEz69lwOQoebrc/sSI8u9EV/Oa4plSB1d5lAHcicqygc+Il iKg50baWlRzHRraleq9xwScM5T1zuvvLzS7L9lhbIY36cv9N3pTv20KhQwcrj2vlbtWp FDug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=eRnPz1c1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p4si1593824edj.221.2021.10.27.14.33.52; Wed, 27 Oct 2021 14:34:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=eRnPz1c1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235794AbhJ0RgM (ORCPT + 97 others); Wed, 27 Oct 2021 13:36:12 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:54126 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S243307AbhJ0RgL (ORCPT ); Wed, 27 Oct 2021 13:36:11 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19RFo9Xx011395; Wed, 27 Oct 2021 10:33:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=L+NlKhelSvgM9MtD5+jKKXS80K0DFKDQ+yOpHQYMv3w=; b=eRnPz1c1fYh35uwnSGq3w30mueypok3Rf5y6pg0cUNCOVLJ9M/xvWKwR7bo2cGC6qrqR +tAcBfsDXEnG0DQ+9BkDR85H7GqpHbypYTCeqh+vhg/zUnRUkvvb5U2LpNvPTsvdJoUZ /AAk7XCoRFJOzTXCgZAllR0uSbQJRp2SPrKpsE/Kv+1sq01Y+lX6UBsCYteHTar0IbmX 7RLxGWWUTtVhYjYT0zA/0awvnJibzrR7JL5QB/rX0IF3qQB7fAQIuvCtWWY+1IMfyU0p TGvGjw0o//14UXrc9GCHObecShmVPM0NYpCNTaukGtRfigWkmVdHxrs0kmTt9Bf/5QQy Dw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3by9rtrfmp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 10:33:44 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 27 Oct 2021 10:33:43 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 27 Oct 2021 10:33:43 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 39CA33F709D; Wed, 27 Oct 2021 10:33:37 -0700 (PDT) From: Rakesh Babu Saladi To: , , , CC: , , , , Rakesh Babu Saladi Subject: [net PATCH v3 3/3] octeontx2-af: Fix possible null pointer dereference. Date: Wed, 27 Oct 2021 23:02:34 +0530 Message-ID: <20211027173234.23559-4-rsaladi2@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211027173234.23559-1-rsaladi2@marvell.com> References: <20211027173234.23559-1-rsaladi2@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: DDBBY3navrn6Zsz_sjhrZpoNeHl5u3G4 X-Proofpoint-GUID: DDBBY3navrn6Zsz_sjhrZpoNeHl5u3G4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-27_05,2021-10-26_01,2020-04-07_01 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes possible null pointer dereference in files "rvu_debugfs.c" and "rvu_nix.c" Fixes: 8756828a8148 ("octeontx2-af: Add NPA aura and pool contexts to debugfs") Fixes: 9a946def264d ("octeontx2-af: Modify nix_vtag_cfg mailbox to support TX VTAG entries") Signed-off-by: Rakesh Babu Saladi Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Goutham --- drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 2 +- drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c index c7e12464c243..49d822a98ada 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c @@ -578,7 +578,7 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp, if (cmd_buf) ret = -EINVAL; - if (!strncmp(subtoken, "help", 4) || ret < 0) { + if (ret < 0 || !strncmp(subtoken, "help", 4)) { dev_info(rvu->dev, "Use echo <%s-lf > qsize\n", blk_string); goto qsize_write_done; } diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c index 9ef4e942e31e..6970540dc470 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c @@ -2507,6 +2507,9 @@ static void nix_free_tx_vtag_entries(struct rvu *rvu, u16 pcifunc) return; nix_hw = get_nix_hw(rvu->hw, blkaddr); + if (!nix_hw) + return; + vlan = &nix_hw->txvlan; mutex_lock(&vlan->rsrc_lock); -- 2.17.1