From patchwork Sun Oct 6 16:40:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dipendra Khadka X-Patchwork-Id: 13823798 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D71AF1C6B2; Sun, 6 Oct 2024 16:40:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728232827; cv=none; b=lp3PiKEKzMFIQv1IH5g+XLfNIVbhrVwHFUHeUeULap7KXKQhooeOf7L7TxKL13CX/aYDUw/2+p8Rcqt/N3bPi7ctuaoakCKrMbKkNzNucz4JUIvME7IUMQubGt19v2IZgms7c6+2+m3+IaIE2S2sfyUsVOX8rRCZVjc9WJAXlzY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728232827; c=relaxed/simple; bh=4VLrjRk5EDWQdgrMct646ETLNR7dC+9hDpCqHUCaPmk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EvU6AWvmxa3Yg2raMwlCsl6g0wgbELETVRXKQ29Ki33CiK1lFNAbqtoj3Vp8pT1Pe1D6I7PlbjeetSNjpxpzFJdcMBtxb9vJ21OEokERRBhxQ08irDjm2VuIKEk5RZ8bTHljdeOKSqOayPzWct8EqnRZK9tcX6mWK7XSgq1telU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JK6LxRdl; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JK6LxRdl" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-71dfc1124cdso470203b3a.1; Sun, 06 Oct 2024 09:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728232825; x=1728837625; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=M6WeitElHDxgk3iGAm5xEDsCx0Na0thFcP57uVIR3NA=; b=JK6LxRdlTX1VczVNh3zcYfPdu90Yr8BUV+H3V79XRme18YbPAMUOP2LixMwGfKVR6N 3CboMlPGznPPxf3gOKvR2ev5TACAs3MzZvSxO5DgdXbp0Bro3KrpX39S/xkKXGuBwpam 1JoBaj9vbAIS6pnolpwYum0Ud4i93i5cgLTh/Dd+GfdSmq989vVRge4JdIVP3IR+1M3e a3gfD2stPnuUgM+2Bc8kIKBLRHalyYrLMeWNN+8hBBD4fiBu0P8gF9iy6eIiCTrYxfDb JMNtR6ppS/mawk2ozcn3w+cDP7lElLOsJJGp00FdEc17otruX1v1BFTuNbcICeuTwW7D nN/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728232825; x=1728837625; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=M6WeitElHDxgk3iGAm5xEDsCx0Na0thFcP57uVIR3NA=; b=At7mO2/Pbm0POAj4JdRwodhsX9xpTNZwj4Ggjjownq/iVrj5cxefpn1MFz5r8FSHP4 J6hnUO+g1cD/Cnm8W6W6wgyVq1DRAph8XGpusS2G18WiXf4lPKTOT6ax8S2pavYnbFjx 7g3bzIyOrvyBrHdaKVxd814Qu6fcXzurQWZFFKqmv4B6+Itoy1KWIW86k5uVUgYunS4K wc5Qsrx0I5openitVbS8TfyMR3GgCq73fxNuJ0ddDi40CJVs2yu/o6LfuEvejyGSdo4t Yy6nLAyC2t2AhthYv1/qWOUgspEFLjavKkaE+fUitYFKU7Pj16+3O+pZJw0FPPE0XGlb 3GfA== X-Forwarded-Encrypted: i=1; AJvYcCUR3EnoeL7QJgr0t+tfHQSvQR8TshbSP6v7LrevdhIP8oqPmlCn88IWeI5yHyJzSRyJn/RHiIdm@vger.kernel.org, AJvYcCW6vkPEzk9Sjk713+I/uyBQ7iCUEP+0es0FKlgZLK9+okq2uYN4smutC/Mzl/DQygAuyzHWIs86GDHSdxw=@vger.kernel.org X-Gm-Message-State: AOJu0YxA6fuAFpehqTGueUpCvCliTY6tBgvgGcSvNxJH06KQSO3Jy1l/ Q1eKN2WecRmROmyTCjwxfbo15DHkdWMbk3EbfCdrWXJoqF146pDK X-Google-Smtp-Source: AGHT+IEizIA7EmpDUsnPiQDZMRkbEqHXrl+d94x34Yer+wBUsuE/CIHZM0CBCP5HaqbO/k2tD5CS3Q== X-Received: by 2002:a05:6a00:1250:b0:71d:fd03:f041 with SMTP id d2e1a72fcca58-71dfd03f290mr4530666b3a.2.1728232825107; Sun, 06 Oct 2024 09:40:25 -0700 (PDT) Received: from ubuntu.. ([27.34.65.246]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0d4632csm2943704b3a.115.2024.10.06.09.40.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2024 09:40:24 -0700 (PDT) From: Dipendra Khadka To: sgoutham@marvell.com, gakula@marvell.com, sbhatta@marvell.com, hkelam@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: Dipendra Khadka , maxime.chevallier@bootlin.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v3 1/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_common.c Date: Sun, 6 Oct 2024 16:40:17 +0000 Message-ID: <20241006164018.1820-1-kdipendra88@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add error pointer check after calling otx2_mbox_get_rsp(). Fixes: ab58a416c93f ("octeontx2-pf: cn10k: Get max mtu supported from admin function") Signed-off-by: Dipendra Khadka Reviewed-by: Simon Horman --- v3: - Included in the patch set - Changed the patch subject v2: https://lore.kernel.org/all/20240923161738.4988-1-kdipendra88@gmail.com/ - Added Fixes: tag. - Changed the return logic to follow the existing return path. v1: https://lore.kernel.org/all/20240923110633.3782-1-kdipendra88@gmail.com/ drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.43.0 diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c index 87d5776e3b88..7510a918d942 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c @@ -1837,6 +1837,10 @@ u16 otx2_get_max_mtu(struct otx2_nic *pfvf) if (!rc) { rsp = (struct nix_hw_info *) otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr); + if (IS_ERR(rsp)) { + rc = PTR_ERR(rsp); + goto out; + } /* HW counts VLAN insertion bytes (8 for double tag) * irrespective of whether SQE is requesting to insert VLAN From patchwork Sun Oct 6 16:42:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dipendra Khadka X-Patchwork-Id: 13823799 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46E5813D53D; Sun, 6 Oct 2024 16:42:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728232941; cv=none; b=SCg+qL5loytucp0IM4u530A8FgdHED6mJy0RLTE4j/C1BmNkG0hcwRMIkP9WYcMOISaFJHCjqaSAROHyCpuClYQf4H1sCywi3VSPn8o3JHuXdMLSdAC75YSJIJLCh5SHBMxdy2WbDg71ObFyxsmQR71rc36yJCUEUvM0V3HS7L4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728232941; c=relaxed/simple; bh=OSA/UttSCQ+RJb0fDFlEFoIymDBh8vyh4InGFlWqfsc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FT6RQGAXUcOe69Rm7hKDpQI3pg3AxU/7t0lqRYTJGHS0DGixMt4ZLOGzyFz2khx8SNc6e9O4zoBShwjEWaGn85s7An/t8Q5qPuJgM6wGMCjrq1k28fyzdXwKFfAlqDUxyZTxPMMuPto58SQgyYRq1Oic2kuzxrcqlNm5WBn+KOE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EHpQnH0p; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EHpQnH0p" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-20b0b2528d8so41983135ad.2; Sun, 06 Oct 2024 09:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728232940; x=1728837740; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LxQpJ5hCgYcs/trf4+eyErsC4uM3M9gAv+Z4ofoIijc=; b=EHpQnH0poEO8UO/NSazmi5Vr4Ucf9yJKgocdGFSUbsPAKWySouwBdMfk3VxH3XhgrP APY2qo2q7S3en6mFAw8XK9qguiO+jzTkFTumfc3vT+G/JVpz/8s4wjH1oSSdbsX9jLQL Qb+Rgofpw7Sr556BN5oZI4h0h8olsHvK5hucAKG5A3kz0xwVG391lwS/fbqcMuvQUMfK 7nvsRRpNnK8rnmLixPoYNQ5LAImxMGDNE8WbeX8FmwrrF3lakBYoCLWeY89P+kk5ujLg zbVUI5rTgbUK/GaTXr0XA4+7nTtJaEUpJW3GARDjCFcLPEgkt4DMbZLf1zzq+mn0GYxr ptaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728232940; x=1728837740; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LxQpJ5hCgYcs/trf4+eyErsC4uM3M9gAv+Z4ofoIijc=; b=FUROl0SSSsM24m+EHxE4A8IySwDONbFXUT8d9J8EOJ8umrtlr4kFUBrYrbGrIuN3fd d+/8Yn2IHxOrcbnGpgqdDEZmdt51hMIGzsBz8biVNJUmwESZD58GlwpWk/zyvyROUgji KuE00AXIXVUxAJCCUvstqAEBSaRzBLEEIsowJHs2ekzziJT4u8Gexf4+4/+9GE2b7CEk uap1uKmFF/MlVIuPDjkMbnqrVFyrSvyINFAdHbFYsH0OXfb2um+ql0GzukDz4wtSTLr7 yd3pBudiGo7fnV0/peKc9TsM/Fu8Vh1Wq1BYpkDPYN0b6lEV5OfbGCKMqs/ue2YKben2 AFRw== X-Forwarded-Encrypted: i=1; AJvYcCUW34/+K2U7v3YUukorpjqKjZM6tHSWKcqeuyaSyldO1rptRbX+QCYHy5REhWgcD6HyA2Rcl7jUX65QWBk=@vger.kernel.org, AJvYcCX29f28sB7E6CEXiRzW1swc2oieH3o49bK0EdkEK0fr5UpJNXcsNUGOWAMH65y0Stm9YcB0RJzu@vger.kernel.org X-Gm-Message-State: AOJu0YwKeb/W4128QO98eRuBeH6K/yXh2HrY0QmrmtqbAfUOO/o7Lq6H DzQzFfQd69+JyonkiAoNqgfh02EYXGVUv0iHW9o8aUfa1HFOmtor X-Google-Smtp-Source: AGHT+IErEEs+qwJd+gGXbQxfLJJkKdz5qkgd/3vADcl5eLKkIigD8X4oh7mIRAAj0BZbol0fGw6aqw== X-Received: by 2002:a17:902:ce87:b0:20b:8341:d547 with SMTP id d9443c01a7336-20bfe01d7acmr114226585ad.26.1728232939686; Sun, 06 Oct 2024 09:42:19 -0700 (PDT) Received: from ubuntu.. ([27.34.65.246]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13968b62sm26751615ad.203.2024.10.06.09.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2024 09:42:19 -0700 (PDT) From: Dipendra Khadka To: sgoutham@marvell.com, gakula@marvell.com, sbhatta@marvell.com, hkelam@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: Dipendra Khadka , maxime.chevallier@bootlin.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v3 2/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_ethtool.c Date: Sun, 6 Oct 2024 16:42:09 +0000 Message-ID: <20241006164210.1961-1-kdipendra88@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add error pointer check after calling otx2_mbox_get_rsp(). Fixes: 75f36270990c ("octeontx2-pf: Support to enable/disable pause frames via ethtool") Fixes: d0cf9503e908 ("octeontx2-pf: ethtool fec mode support") Signed-off-by: Dipendra Khadka Reviewed-by: Simon Horman --- v3: - Included in the patch set - Changed the patch subject - Added Fixes: tag v2: Skipped for consitency in the patch set v1: https://lore.kernel.org/all/20240923113135.4366-1-kdipendra88@gmail.com/ .../net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.43.0 diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c index 0db62eb0dab3..09317860e738 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c @@ -343,6 +343,11 @@ static void otx2_get_pauseparam(struct net_device *netdev, if (!otx2_sync_mbox_msg(&pfvf->mbox)) { rsp = (struct cgx_pause_frm_cfg *) otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr); + if (IS_ERR(rsp)) { + mutex_unlock(&pfvf->mbox.lock); + return; + } + pause->rx_pause = rsp->rx_pause; pause->tx_pause = rsp->tx_pause; } @@ -1074,6 +1079,11 @@ static int otx2_set_fecparam(struct net_device *netdev, rsp = (struct fec_mode *)otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr); + if (IS_ERR(rsp)) { + err = PTR_ERR(rsp); + goto end; + } + if (rsp->fec >= 0) pfvf->linfo.fec = rsp->fec; else From patchwork Sun Oct 6 16:43:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dipendra Khadka X-Patchwork-Id: 13823800 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB8B1189B8B; Sun, 6 Oct 2024 16:43:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728233013; cv=none; b=EJe+ODV2q5qnywej5xCtpTvqRnR1PmKROH2fJketpUy5w0NOG1F1X4t9HsorU7+c3tlh/G1/GZ++1FoHKT9Rcl/xyzlpqWUMgD8WS/qxpgC9tK3HBHQRXZPz0fUvTiPCMl2Q8+VFI9+USXA4oJebeT5UXO6hN/TcdTAjc/22ZKQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728233013; c=relaxed/simple; bh=Q8g3holWCmt4KRRwSk6tBXgvpK13/hoLyqz5wayyThE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=oardLcE4pdwnvuylnbRvd5vGCZ8BmHQKnbhTta6VW+RDaL7c1tziwI0DzWylipNQ5JpHNhjG+hTco4OJTmVA11NQRc28mHuE+2yvGehMymWf3vJtfr9ITwnzqT2TiJlBADw6cZGE+nKPxrDht6J5sitwcukdSWyrObYix/teq7A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kOD32BJ6; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kOD32BJ6" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-20b1335e4e4so36636665ad.0; Sun, 06 Oct 2024 09:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728233010; x=1728837810; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NcTqkghSEH/q4hS2U1EtYqhdI2AKRpEW4xQ96+uRbkA=; b=kOD32BJ60+2rYkzdb/6/pT/hTynktYDdXyOdojcxJWW4sFH8EZyEnBDpMuZtHCDJ3/ aQBf/ymAayK22jpZbhUsfIxgPFwjL7e5DWOfKcz00m4p3enDvQJvYdU1kV5EixSDfNqZ 6218pUcTXzuhdtJh2mP7ZjGzNMcxtsP0qS9/+cpv8BcDmMckQGrmWx0y8xQw2Coodbc0 xSfLSsHKvveYBsdWD8SRKuOlDnriS4E+6DaWJe8GitkaJdayhuU/W6zQL/W9o1CjU+WY odJgNQ1BVJ363nIA0FPZx6yZyLirGAr0I/i8n3zZeCv1EWHYc6HOe5Lr0+KO0ppd7wgI nLug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728233010; x=1728837810; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NcTqkghSEH/q4hS2U1EtYqhdI2AKRpEW4xQ96+uRbkA=; b=pUYWMoLZUatYMd/MRj7DC4xrUsYJLNIm3JF2XbtxR3063IMI/xxuQxnQj1r45jHRW1 yugYOgFEOzbeQr8zZweOTKiCMORYMppRJRfAyVNITNLRiVifmwl13DFJP+jFuVUpBa8d xTBy2ywolt+iVF2ylYoUNbPLExL9nmL43OYXhDgSf0LV5eV0+QZrHVhA/GGggeqLpRm6 okslTncYFpB3m5eKZuUOR8rW3pLLN0tFsoZ2Vf6VykxDCeBbSVhScrMsAwsdx2bv6/qb v3QEZeAR6VZcLeEQSJRSsKr+ON1Pw86ti9/0g4F9RAxWnTcKm66vp3J8+Qae4tw7K3RD DKgQ== X-Forwarded-Encrypted: i=1; AJvYcCW4TRHxMv8b43J6Wx44MdK0zCY1FqkyCg2Eg9LSxiiz4sEqhF/o4nSUP9bH6qJ4B7ZqsZ1OAwe2@vger.kernel.org, AJvYcCXPT+fr7qSAH1yN5Fj+cn6d/sbAZFF3sfGXqmpNfZ1+DreEnDiJd+s8lZNITTH8suN9e5Gg6e3IwmCRYXk=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2mV2ogF7+iUo+9hND0npkjs9zMMJV2ydWRFd7wzEsV0RkrNg3 jeffzBdHfVd2DxaCAPQK+LjS7EZTi4iH92UAZxW5gAiIgA9zhmXO X-Google-Smtp-Source: AGHT+IE+oXMDeSfi7ThB0cWJtlPa+K/pDk7A51QXl7QpMbzhMpnq3SMwAmcNpjioJe1vcpG+iXW/Iw== X-Received: by 2002:a17:902:d483:b0:20b:6208:b869 with SMTP id d9443c01a7336-20bfe01dbedmr130055505ad.24.1728233009847; Sun, 06 Oct 2024 09:43:29 -0700 (PDT) Received: from ubuntu.. ([27.34.65.246]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138af935sm26880845ad.54.2024.10.06.09.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2024 09:43:29 -0700 (PDT) From: Dipendra Khadka To: sgoutham@marvell.com, gakula@marvell.com, sbhatta@marvell.com, hkelam@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: Dipendra Khadka , maxime.chevallier@bootlin.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v3 3/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_flows.c Date: Sun, 6 Oct 2024 16:43:21 +0000 Message-ID: <20241006164322.2015-1-kdipendra88@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Adding error pointer check after calling otx2_mbox_get_rsp(). Fixes: 9917060fc30a ("octeontx2-pf: Cleanup flow rule management") Fixes: f0a1913f8a6f ("octeontx2-pf: Add support for ethtool ntuple filters") Fixes: 674b3e164238 ("octeontx2-pf: Add additional checks while configuring ucast/bcast/mcast rules") Signed-off-by: Dipendra Khadka --- v3: - Included in the patch set - Changed patch subject - Added Fixes: tag v2: https://lore.kernel.org/all/20240923063323.1935-1-kdipendra88@gmail.com/ - Changed the subject to net - Changed the typo of the vairable from bfvp to pfvf v1: https://lore.kernel.org/all/20240922185235.50413-1-kdipendra88@gmail.com/ .../net/ethernet/marvell/octeontx2/nic/otx2_flows.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.43.0 diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c index 98c31a16c70b..c96f115995f8 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c @@ -119,6 +119,10 @@ int otx2_alloc_mcam_entries(struct otx2_nic *pfvf, u16 count) rsp = (struct npc_mcam_alloc_entry_rsp *)otx2_mbox_get_rsp (&pfvf->mbox.mbox, 0, &req->hdr); + if (IS_ERR(rsp)) { + allocated = PTR_ERR(rsp); + goto exit; + } for (ent = 0; ent < rsp->count; ent++) flow_cfg->flow_ent[ent + allocated] = rsp->entry_list[ent]; @@ -197,6 +201,10 @@ int otx2_mcam_entry_init(struct otx2_nic *pfvf) rsp = (struct npc_mcam_alloc_entry_rsp *)otx2_mbox_get_rsp (&pfvf->mbox.mbox, 0, &req->hdr); + if (IS_ERR(rsp)) { + mutex_unlock(&pfvf->mbox.lock); + return PTR_ERR(rsp); + } if (rsp->count != req->count) { netdev_info(pfvf->netdev, @@ -232,6 +240,10 @@ int otx2_mcam_entry_init(struct otx2_nic *pfvf) frsp = (struct npc_get_field_status_rsp *)otx2_mbox_get_rsp (&pfvf->mbox.mbox, 0, &freq->hdr); + if (IS_ERR(frsp)) { + mutex_unlock(&pfvf->mbox.lock); + return PTR_ERR(frsp); + } if (frsp->enable) { pfvf->flags |= OTX2_FLAG_RX_VLAN_SUPPORT; From patchwork Sun Oct 6 16:45:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dipendra Khadka X-Patchwork-Id: 13823802 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A30B9101C4; Sun, 6 Oct 2024 16:45:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728233116; cv=none; b=et3t8hZuxOC84sUuAAdzM5dd0Rb9VbAKUw6ukh0d1YvdjYmk433F5TpNGLe55lh4cisTnQBtHLdFiU6CePBTGpsc5JKjUKZlmEgjS8fkJ21lrjQb8FWuYQ5K9IjwQLEzGerfX2ufwtTiNR9tPRvSqxHhF5JGMncJK0Y7V8I/nSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728233116; c=relaxed/simple; bh=QbZnEnt1banKnTIbdv1SzAoVyjQs4f5eql/pK7NjcXw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=WDmypjG/IF/6TEEjaq7HaDX9HRz3vWKFJr1W4lgzu2b3RL+JLsv3B0ebJuscxTjxXGphUk4GyP7vZfgt0qCl+hNh7o6F6M31NYKsuPMu+LKquqaBhZB1SbAc/aBRm4DFDEnRfnfeOMAXDn9xiTLC8Q5dCLuY7Zd8iMrMyKZLtL0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RaHPTrnI; arc=none smtp.client-ip=209.85.215.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RaHPTrnI" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-7d4fa972cbeso2510383a12.2; Sun, 06 Oct 2024 09:45:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728233114; x=1728837914; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=gDSXLjvpLxqWxXHVbrKPpR5QLgHr8pG6IHSrQY1XA8c=; b=RaHPTrnIhGa2OJN9Cds2aUTram16yXsjPmy6ftfEe6l/I0HApDZQarG2aCFo85EgIz h1pb5IYkBngb1bB56rczectERW5YQj/7XfLXE1Q9o23taL0VohdCvmVLmJSvnCTBeijk ye12CGwMctZPxpThxVFe7ugGU+xlwg3aD4GpCxctzYnvGCEbsvBPEuZNPgU+kRR8P4hJ W7sjodTB6jLqIi9/4dI8Kt8DuV9PfMtrz5uxD+rJItBroXkW7+Cl0LtxD9aC4eqc/Fi8 kxeNls+e+QEsFYkw8GuFvU0fkcsAV3EYwPcAOl6hm/2NPOhVvd+I6w3/0zUmeSYxYDKg oX4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728233114; x=1728837914; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gDSXLjvpLxqWxXHVbrKPpR5QLgHr8pG6IHSrQY1XA8c=; b=WzvqJAHc0Hz5x0onG3LzSBJtHQUsQ/u8tlCXP1F3FWtwP3ojBBPVpK+k7y5nZm85dk UmPMQzNLLD7xQY6oI9qSgIfs4+820+M3fYd2rR+J687ZJRSdp8nsg+de1eeKmwla5Doh WWnxP02n5cfiLyfJ/fCxZ/YxSAg6UJpkO/qz5QKD48KEjoGrz5/CcDYw9wuuseYm3agr SKGVSk0+GIVuaLz2o0HYabEj/DfGIM/kHTzsAhP1Sly1Pgf3b1MLpyhWiKSdW7AXZWcE 1qlW2V7Jb302PQ1dfio09P2BAxfRpv0f2P34jNx2sbcX8oagU5oO7Y4dDAl6AOONmbaj q2kA== X-Forwarded-Encrypted: i=1; AJvYcCU7BR05NE0NlkAx8tN2zQ/XaI30nTEKigC7SRcwxNyt5MUCEiM/5dpr1uG7QUFJanPqzAyt8lpMyQfdvJI=@vger.kernel.org, AJvYcCUX3CH024/9k8dnC8UlZd/qbRApsDWuDhhhD1LGeMPSz9XND0Qbc6njraYpjy3QW5WeuDFAQjmL@vger.kernel.org X-Gm-Message-State: AOJu0YwD/FcfBbL3VHvTMce8dPq0LVdzmpuK6qLLuttFWz9MLXZA1hat HGSc25l407JZMZRc+4Wa0uDFm1wFgExJ0b93x3EsYPGOEy8PI8ED X-Google-Smtp-Source: AGHT+IGjuI5jIj7YSmywhBivlbOrhgRxaq6MB/mcaHO1MKIYwlSHETQBuB0Qogj9l5rAMcV9SPQLTg== X-Received: by 2002:a05:6a21:118e:b0:1cf:6625:f05 with SMTP id adf61e73a8af0-1d6dfafccebmr12808603637.50.1728233113906; Sun, 06 Oct 2024 09:45:13 -0700 (PDT) Received: from ubuntu.. ([27.34.65.246]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6c35e68sm3330942a12.65.2024.10.06.09.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2024 09:45:13 -0700 (PDT) From: Dipendra Khadka To: sgoutham@marvell.com, gakula@marvell.com, sbhatta@marvell.com, hkelam@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: Dipendra Khadka , maxime.chevallier@bootlin.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v3 4/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in cn10k.c Date: Sun, 6 Oct 2024 16:45:05 +0000 Message-ID: <20241006164506.2082-1-kdipendra88@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add error pointer check after calling otx2_mbox_get_rsp(). Fixes: 2ca89a2c3752 ("octeontx2-pf: TC_MATCHALL ingress ratelimiting offload") Signed-off-by: Dipendra Khadka Reviewed-by: Simon Horman --- drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.43.0 diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c index c1c99d7054f8..7417087b6db5 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c @@ -203,6 +203,11 @@ int cn10k_alloc_leaf_profile(struct otx2_nic *pfvf, u16 *leaf) rsp = (struct nix_bandprof_alloc_rsp *) otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr); + if (IS_ERR(rsp)) { + rc = PTR_ERR(rsp); + goto out; + } + if (!rsp->prof_count[BAND_PROF_LEAF_LAYER]) { rc = -EIO; goto out; From patchwork Sun Oct 6 16:46:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dipendra Khadka X-Patchwork-Id: 13823803 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3837013BAF1; Sun, 6 Oct 2024 16:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728233186; cv=none; b=gfQ+QOpUodgcGsbuHCkFIZKi2QBZ6cR+Oq+2+Mym6qGcwGRjK2zdq1yNa9U2xjmZhkMo2yKHNB8fjqobONKfEPNo9i9hy7NEPpBjHseNPUYoKVTIJOPLKAMX30fa36thAZ04wVsKuvdLbupc3MmDtN/xTLcUgsH0P9DNzT70T2o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728233186; c=relaxed/simple; bh=idDuaJFxhvKUm/JPk8hcN5sN3CIqA0/zNhff5+G+Dbg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=IFiN6dBwhIU2IUh6K1ZHxh2KSP3FeTZtFWukuA2hJWUdQ4l7e4HDVpF0ilvDooNVkybXvt9bfMAlfuVEIWafAqBedBImdNHNpDQaE2oXdIPYP/Ejw3963RcinxSq8jEkiuI10iTFSSCLdWnjTYCMS746vdE+NThsGO8fm6WFiHo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fdDtNwJw; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fdDtNwJw" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-71dfc1124cdso471721b3a.1; Sun, 06 Oct 2024 09:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728233184; x=1728837984; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=tFQsXFlFPeoxFKDhANXjQZ1y6bTyuC9Jy0Iq/wXyfKE=; b=fdDtNwJwY5HRRHJZQWYzfuqumUP+YzTyyBxAK+9og9QMtje6Lsnp/utmZcuhxVc2Ad kTkkEmMtqvNfEy3tEYfaiAyOEuGUByUlSbWH/1OpSogL0lPE/Zbo9lCD4rtcf/AeNBI9 4bVAczYMVLvNJcoB0cTlBgEVwQP+crZhk4WBQgKDIu6thsGUooy5BruiQvSryi/j+kgA ENlOyW0mFQY3JK6Izc/E6qDUFVC007u5wX/sRGGDeSFL4YjWo9e3+/as7L2jKq92J3xz dozqwNndrQDJtAimXNnQtYTazBWOkcJi6b+HBmR4ACTIL64LwW3njJUGcJjK+Adf8vv7 SRkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728233184; x=1728837984; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tFQsXFlFPeoxFKDhANXjQZ1y6bTyuC9Jy0Iq/wXyfKE=; b=WiL9Ec637HKTTfiIUy4IoY1NsOuKuaFBZV3Ges+M08RLHKh7sxG4zIgV4NEI6kbpJH yKTDkTgmzFKs403r8dOkMoNQHJFymBDpCa6Bm+w/yRepee4kVrHg+Z4FDhcZiJ97Plef 5xRPuIC2TprRDPXr1n/ZAj51cs6MkVs7Eop0X+NIbVFz7AgWFDU+heR/pRSMDa9PY9vd hpvL17BEur1qDgTqOpCXB2PPBgasla9YZSw9a0aaP9FtAnvuMZ5M68zg+x4oKppqTKTo T5gt0KE1KIrPs45yP6OI8RcgjAKJhwJu1639lO5Tj0F+eNcxYIoXNT4jaeF+fRUHFTGs CGug== X-Forwarded-Encrypted: i=1; AJvYcCUcwOp0EuWI49PiDv95I2YFc9NgTaIDz0iMYv73vujUItUdSJWyX1QmxFz0dG8UC1hluR7L6xIsOR5A+L4=@vger.kernel.org, AJvYcCVCDTGymeZiuf2Qn67i8Gl8bn2vup2Gm9WNCo0TePGtpcBlO8cw+l8SkIhLXuaFfRKI2+KU+dBr@vger.kernel.org X-Gm-Message-State: AOJu0Yxb+uC1XPaJypCoNeVvvo+oyiaYErXKvybgYnJQp8DbpPHFVUdD 3q1R62C4uxtKTPbhj+gZgvfcrcSP2VJ3p1kLFk5whCJDOe/DTwgu X-Google-Smtp-Source: AGHT+IG/JHVArR6hcR5pQL33OYj5ExdQPlXvf9LyKYVmdjMnbc+lcGV3uJl4fqDpWek8zWYvs+qygw== X-Received: by 2002:a05:6a00:17a7:b0:708:41c4:8849 with SMTP id d2e1a72fcca58-71de234fd22mr13942535b3a.9.1728233184543; Sun, 06 Oct 2024 09:46:24 -0700 (PDT) Received: from ubuntu.. ([27.34.65.246]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0d7cf37sm2957497b3a.198.2024.10.06.09.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2024 09:46:24 -0700 (PDT) From: Dipendra Khadka To: sgoutham@marvell.com, gakula@marvell.com, sbhatta@marvell.com, hkelam@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: Dipendra Khadka , maxime.chevallier@bootlin.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v3 5/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_dmac_flt.c Date: Sun, 6 Oct 2024 16:46:16 +0000 Message-ID: <20241006164617.2134-1-kdipendra88@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add error pointer checks after calling otx2_mbox_get_rsp(). Fixes: 79d2be385e9e ("octeontx2-pf: offload DMAC filters to CGX/RPM block") Fixes: fa5e0ccb8f3a ("octeontx2-pf: Add support for exact match table.") Signed-off-by: Dipendra Khadka Reviewed-by: Simon Horman --- .../net/ethernet/marvell/octeontx2/nic/otx2_dmac_flt.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.43.0 diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dmac_flt.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dmac_flt.c index 80d853b343f9..2046dd0da00d 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dmac_flt.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dmac_flt.c @@ -28,6 +28,11 @@ static int otx2_dmacflt_do_add(struct otx2_nic *pf, const u8 *mac, if (!err) { rsp = (struct cgx_mac_addr_add_rsp *) otx2_mbox_get_rsp(&pf->mbox.mbox, 0, &req->hdr); + if (IS_ERR(rsp)) { + mutex_unlock(&pf->mbox.lock); + return PTR_ERR(rsp); + } + *dmac_index = rsp->index; } @@ -200,6 +205,10 @@ int otx2_dmacflt_update(struct otx2_nic *pf, u8 *mac, u32 bit_pos) rsp = (struct cgx_mac_addr_update_rsp *) otx2_mbox_get_rsp(&pf->mbox.mbox, 0, &req->hdr); + if (IS_ERR(rsp)) { + rc = PTR_ERR(rsp); + goto out; + } pf->flow_cfg->bmap_to_dmacindex[bit_pos] = rsp->index; From patchwork Sun Oct 6 16:47:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dipendra Khadka X-Patchwork-Id: 13823804 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55694101C4; Sun, 6 Oct 2024 16:47:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728233232; cv=none; b=M/jicu2Xg9l+UMOaAUKp2uYjJ+dof1AFeTjsUymVxNXrQUY+BgjDqIkESs/2Wb5XRWkPxEjAZzqyEd3GbrthTswk8OcLIuPcY3JDBZ7J7QnCzKapzXSW0giu6XYbuL+WGX1aqaDQnrmF15cF/h4C1rmKcDJU7FTvo8VHudo7gSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728233232; c=relaxed/simple; bh=BautKf7vziCSJbSfESOL9y3Dv626eoXGdCzCtqq7Nks=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DLJpvz8S2204uZDn8bKWXyVGHSG7ZWZOVBEVMAfZ7ehE5EC2fQu63gOWrxXUZPJV4UAjC3rPe6z/RP6UzFteJG0ZZM3Fnf5/YCzTzpY5PXIkTXBlZLP2swWckfB0IeAHZy53TVXSwp7+jP1bC050rVeKH0cLZIXoTvMwPLmkfxg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dxnOMGio; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dxnOMGio" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-20bc506347dso29949105ad.0; Sun, 06 Oct 2024 09:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728233231; x=1728838031; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vC0tEgvksW2SjvqO5D8v5m9lP9JGQ5m114TaIw9h+/Y=; b=dxnOMGioCL4dV1gcoyo7HYcihe5lnuWRXgIP58KvNQri0FvN6QBqfVG7K8nrjClGUN n3aUG4KtMQoehyMR0NL3ZbiOSe1lBFVZHpMxUn2KS6FAwlKG0QQozzSOMOxawQWKWneP 4fIE7DHyptYh+ywyBfziIJZ95KLkV98dRzvi9ZqfI/3dy48/CXui1vooO2LCkbnY4xw5 OEpO2bn3ani3PXACYUTstZfWu8eI+Rjb+Bqa8Ydf+O4UmHwnLPCdI/hS1wD6eyHGd5Kp XGRhT6T76ELlVbDCmdeYZnflu8OwekK5nP74zMYj8LjSbVJf4BOQsgHbRP+Lmf7WOo++ dYTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728233231; x=1728838031; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vC0tEgvksW2SjvqO5D8v5m9lP9JGQ5m114TaIw9h+/Y=; b=WsknVT9x/KtfXPgdmC1DnlpMQLxG+y5tw74xe7cmVE6ejDTP4g9BDsGC1JZo53NU1O DOW8h0sifLG6fXyuwYpIjeGvjJEQL4nWevvk5heg4UgPU/e21TrQIrWCsNtoZ9297hJl RN1aoXy0aI1ZVtjDja7CaapxhxN7eC+eIAsEO0XcJvWJ54WtaASsWB3IjERoy5uJTx3Q mqNSrrFBm+770fi/eWksv3srUeiW0vjpVDNG1l4YsTOpeNmNhM2wR1IlS6VvLX0hmPXP zvcmCyUble9wSgSYP1VFXAqd8oBKbkIoqKFgwCl+C6hRGYLhzrDdRL/hhiFY+yl9Qhaw C+uQ== X-Forwarded-Encrypted: i=1; AJvYcCUAhKcMfrf/46XR5LVoVK65utVcBD2QmOlHnMvAYGDAy9dBNjZIsguNtcUSqXnFFmRln7tdJa0KAy9QF6g=@vger.kernel.org, AJvYcCW1+F7UpamzoxyE+NojOQWL4xql89bJKOlolPS03F7Ff4Y8iCoWMMz6i6VUWB/ZlyTdw1OTMUxs@vger.kernel.org X-Gm-Message-State: AOJu0Yz7gRWmDJQEKJQtWPq/o9xlZzAVPecI4tcUls97InN4by7AWCbU Ugd/blv+XdujfL3mOT0auk+yHx4dUxwKTchhEouh+BSLT2BiXC1D X-Google-Smtp-Source: AGHT+IEnhpQUWb5mxVaLQ2SKQxy8kq5tKtkBJX1KjP115+fvNsvSxdaEFuonYwJ7fRASOvOhRqeJVA== X-Received: by 2002:a17:902:e810:b0:20b:cae5:dec4 with SMTP id d9443c01a7336-20bfe0626c3mr128373975ad.24.1728233230618; Sun, 06 Oct 2024 09:47:10 -0700 (PDT) Received: from ubuntu.. ([27.34.65.246]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13930996sm26997295ad.169.2024.10.06.09.47.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2024 09:47:10 -0700 (PDT) From: Dipendra Khadka To: sgoutham@marvell.com, gakula@marvell.com, sbhatta@marvell.com, hkelam@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: Dipendra Khadka , maxime.chevallier@bootlin.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v3 6/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_dcbnl.c Date: Sun, 6 Oct 2024 16:47:02 +0000 Message-ID: <20241006164703.2177-1-kdipendra88@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add error pointer check after calling otx2_mbox_get_rsp(). Fixes: 8e675581("octeontx2-pf: PFC config support with DCBx") Signed-off-by: Dipendra Khadka --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.43.0 diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c index aa01110f04a3..294fba58b670 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c @@ -315,6 +315,11 @@ int otx2_config_priority_flow_ctrl(struct otx2_nic *pfvf) if (!otx2_sync_mbox_msg(&pfvf->mbox)) { rsp = (struct cgx_pfc_rsp *) otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr); + if (IS_ERR(rsp)) { + err = PTR_ERR(rsp); + goto unlock; + } + if (req->rx_pause != rsp->rx_pause || req->tx_pause != rsp->tx_pause) { dev_warn(pfvf->dev, "Failed to config PFC\n");