Message ID | 20230503070944.960190-6-saikrishnag@marvell.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1136462vqo; Wed, 3 May 2023 00:25:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7vxdPqaWj+Ij/BBLOqirD4A8qhzD3ZI8sKdwOfWrxbc5NuRuVqfn3/zPUHSBn5HQScolqJ X-Received: by 2002:a17:903:234b:b0:1aa:ed6f:29c2 with SMTP id c11-20020a170903234b00b001aaed6f29c2mr1481093plh.11.1683098719557; Wed, 03 May 2023 00:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683098719; cv=none; d=google.com; s=arc-20160816; b=WQcZSi8wT4MQTBV0aCr+NmIuvxn52n95cPhcsMJTEKswRFlNR6uG3apN6hDti9BWav R6O6PrdRQiIzHlrN3SHdoLvtSmgtdaNcvfNHkuh+YuWUozOL5FEu7e3U7eVTHipKzn5x p7nCFkT/AfzlrgMed09wGUeGMVwKnCMirWMN1a/2Nku/DLkjAVwMrIrJw0b1RNRFE+cp rqHUvnCgG5Rz4TiMu8KwsZfoYq7aQEs+g/+e8NNFAe+oCb2mCeDO6QpuKi3xRPx9zNUD olc82n0H+4cgSM7vxSvTXMR/Epixpe/6/8W9ZuE4GGogrlW/vBB/42EcfdLwkJjKxw6x jc0A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZlSrOLdBRNFKeLr7Ip+8w0eprD3EHpIspAhBFP9tXz8=; b=U4XfFwP7nlGktkEySm7fC7F4i+TwU4L/UOv3K1IeCJtr2dKLF8wbif6fgBvovnKHoj NwNxGMdbD7RW981tTJZwUnDPtyqwwlj/nwWybIsUcRjorRjuDWZbJCe+k7C+VTjPbVGD wfSl8qJQ19Gr1a9L5dj9CxHoJ3yLEyyeG12FZ/dL1tWEkqJuHbBjJx6ipJlPEJXK5zkD jZEEWTzp5D4sSmt9Wpgf0hhphYnMjFzXL/vNnDn05vktbzGHDvvYysl0BkrjIYezWc8r pcz6YPr9O6IQC2qywEq932wW3XLIniWGUSxM7f8/uycSe4JpTQ9Tg9uqsp8pu8UbwsxL tGwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=aAOHEL2R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg1-20020a17090326c100b001aaf62c76cesi6376413plb.129.2023.05.03.00.25.03; Wed, 03 May 2023 00:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=aAOHEL2R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229721AbjECHKp (ORCPT <rfc822;heyuhang3455@gmail.com> + 99 others); Wed, 3 May 2023 03:10:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbjECHKe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 3 May 2023 03:10:34 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AF2C4223; Wed, 3 May 2023 00:10:29 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3436AsGR004505; Wed, 3 May 2023 00:10:17 -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-transfer-encoding : content-type; s=pfpt0220; bh=ZlSrOLdBRNFKeLr7Ip+8w0eprD3EHpIspAhBFP9tXz8=; b=aAOHEL2RA4pToiPZJEbz48+w4sePaoB8HNfrvK2p+ABqkIORQ2CKkaT9PHP2T0apZk0a hQD5G99S+0iaOy5+TMa+myfvfGnTo4hARGXBdjJfr/uqwJp3ilQyp7N/P4QPnA1guCHn BoMMotlCysJhpdc3xplRIrvHTzP2ovfqqla58LUmZJhKYfXgFToFvWgFlfljzd1IgUVP TiyrX/vEHDl+7fvZMmKXUHDhAVUaPj0wNwiUYO+qsNZL72/wAEsvzfl84SdfWfiQ3eMI +cnZLY0FW4LpJGoY72NVTTyKe/gKfEZFjAlkMAeg+krcX20Fe0l5SJSoaEyhO6pzpCes gQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q92rp3m7v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 03 May 2023 00:10:17 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 3 May 2023 00:10:15 -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.48 via Frontend Transport; Wed, 3 May 2023 00:10:15 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 4379A3F7082; Wed, 3 May 2023 00:10:11 -0700 (PDT) From: Sai Krishna <saikrishnag@marvell.com> To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <simon.horman@corigine.com>, <leon@kernel.org>, <sgoutham@marvell.com>, <gakula@marvell.com>, <lcherian@marvell.com>, <jerinj@marvell.com>, <hkelam@marvell.com>, <sbhatta@marvell.com> CC: Sai Krishna <saikrishnag@marvell.com> Subject: [net PATCH v5 05/11] octeontx2-af: Add validation for lmac type Date: Wed, 3 May 2023 12:39:38 +0530 Message-ID: <20230503070944.960190-6-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230503070944.960190-1-saikrishnag@marvell.com> References: <20230503070944.960190-1-saikrishnag@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: mugEdnywIu1dptctzCkIXq5IiRZSHBAL X-Proofpoint-GUID: mugEdnywIu1dptctzCkIXq5IiRZSHBAL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-03_04,2023-04-27_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764856923143723016?= X-GMAIL-MSGID: =?utf-8?q?1764856923143723016?= |
Series |
octeontx2: Miscellaneous fixes
|
|
Commit Message
Sai Krishna Gajula
May 3, 2023, 7:09 a.m. UTC
From: Hariprasad Kelam <hkelam@marvell.com> Upon physical link change, firmware reports to the kernel about the change along with the details like speed, lmac_type_id, etc. Kernel derives lmac_type based on lmac_type_id received from firmware. In a few scenarios, firmware returns an invalid lmac_type_id, which is resulting in below kernel panic. This patch adds the missing validation of the lmac_type_id field. Internal error: Oops: 96000005 [#1] PREEMPT SMP [ 35.321595] Modules linked in: [ 35.328982] CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.4.210-g2e3169d8e1bc-dirty #17 [ 35.337014] Hardware name: Marvell CN103XX board (DT) [ 35.344297] Workqueue: events work_for_cpu_fn [ 35.352730] pstate: 40400089 (nZcv daIf +PAN -UAO) [ 35.360267] pc : strncpy+0x10/0x30 [ 35.366595] lr : cgx_link_change_handler+0x90/0x180 Fixes: 61071a871ea6 ("octeontx2-af: Forward CGX link notifications to PFs") Signed-off-by: Hariprasad Kelam <hkelam@marvell.com> Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com> Signed-off-by: Sai Krishna <saikrishnag@marvell.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> --- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c index 724df6398bbe..bd77152bb8d7 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c @@ -1231,6 +1231,14 @@ static inline void link_status_user_format(u64 lstat, linfo->an = FIELD_GET(RESP_LINKSTAT_AN, lstat); linfo->fec = FIELD_GET(RESP_LINKSTAT_FEC, lstat); linfo->lmac_type_id = FIELD_GET(RESP_LINKSTAT_LMAC_TYPE, lstat); + + if (linfo->lmac_type_id >= LMAC_MODE_MAX) { + dev_err(&cgx->pdev->dev, "Unknown lmac_type_id %d reported by firmware on cgx port%d:%d", + linfo->lmac_type_id, cgx->cgx_id, lmac_id); + strncpy(linfo->lmac_type, "Unknown", LMACTYPE_STR_LEN - 1); + return; + } + lmac_string = cgx_lmactype_string[linfo->lmac_type_id]; strncpy(linfo->lmac_type, lmac_string, LMACTYPE_STR_LEN - 1); }