Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp199672lqp; Tue, 11 Jun 2024 01:29:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZPfVnjGma8aKqMnj6UTNgF/Q/DTb/5PmGB5P2HxOQEYz7iLwvSTPqqm5RaQYseFnpz30ogmbf9U/8TzS0N+Q89yj6nXOAYuRAu8IPGA== X-Google-Smtp-Source: AGHT+IG47oY2cPUWKJkgoM41r3DHTpUQ9gtFGwAut1344JNyYwh5QPUiMyqDwyplM1xoxUiaP9Fd X-Received: by 2002:a17:903:230c:b0:1f7:2134:e8a4 with SMTP id d9443c01a7336-1f72134eaeamr30551555ad.49.1718094577636; Tue, 11 Jun 2024 01:29:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718094577; cv=pass; d=google.com; s=arc-20160816; b=OR2JemdpAUYHtVFIbf0gYk3Vwpb7CC6r2YGqlYyIDodrRR5pfxIvohwl/ADGG5Vj23 U+z/URBdBFdkgeMcU/VjNYg++I+yAox5lHhbggwDcLokmNzYQi6oxKqwh8lYvp0d6M/h vQNgMyRJ3G+EyS2xY7jYw9zYgBl5vYUm4p2Pxo4nrwB9GHhxwncrIyvj1iXWFp9QEBy9 48l6964FX31UCfHLDOrbAoGboUnHf8px1WiSytYJ4scgC1SmAmYe868hBpYk6+KKHxOz O/C5Phl1nxmZ7fZViFLrBFXjOASRzdo/nAXAgM/L18Xhzw2YXt/QTtkUpVg/APD9AoAg E+gQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=oFr2YS8xOkbzW4Son0Mqyup2AFLMMw+xc2c2p9yDb7s=; fh=RQID1kRYHBRV041WnK18puLmO9Qg4dSb1lH1G+clEbk=; b=hgWwz3Gxh+Bp6UYidQ3YQg1l0LpH9t3ZOTuE55vsqkLqk8SClxN+CgQkpOOHniwBmC v4pPNkEcVB7uv6AfawiWJ/fUsW9MuX/+U6L4wRaNhisxuBF+bdvbi86KEvfrttCtoLsl h6LGCqAxtfQfGWg/NIW4WOkweWh9h7gWlayyofXnftuK+1VXGvZ0a1HXfRDN/M9NxaMp AQlbOhWfwPnY6pQxGrLImy6iSKRCYlycaJ5afSz0cKPGecLmlzwtYdwhYeoi4w0ZN54r pKzbLJn/YeI8yi6LzZViqS4fLRCSNcxuUrsfgp8LFI77pQNLAoxV4sBZfebeHoGz19c+ QNeg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@t-argos.ru header.s=mail header.b=Kd07t7jM; arc=pass (i=1 spf=pass spfdomain=t-argos.ru dkim=pass dkdomain=t-argos.ru dmarc=pass fromdomain=t-argos.ru); spf=pass (google.com: domain of linux-kernel+bounces-209472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209472-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=t-argos.ru Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7f40fasi57803225ad.482.2024.06.11.01.29.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 01:29:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@t-argos.ru header.s=mail header.b=Kd07t7jM; arc=pass (i=1 spf=pass spfdomain=t-argos.ru dkim=pass dkdomain=t-argos.ru dmarc=pass fromdomain=t-argos.ru); spf=pass (google.com: domain of linux-kernel+bounces-209472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209472-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=t-argos.ru 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4F042288CF0 for ; Tue, 11 Jun 2024 08:28:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 62023174EDF; Tue, 11 Jun 2024 08:27:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=t-argos.ru header.i=@t-argos.ru header.b="Kd07t7jM" Received: from mx1.t-argos.ru (mx1.t-argos.ru [109.73.34.58]) (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 57044152178; Tue, 11 Jun 2024 08:27:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=109.73.34.58 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718094466; cv=none; b=hCPcLR8y1oSPLG+Gjv/3REPdg8GDhtztPOQvRR3FMbERA6ft38SjUMrPk+cGFgcBPQ02AkbsPSkcPGAQK9Gsljy+KL+x4VCW8XcPtzuhzWQYpLvt0QFnYdSFnR930/8Qffm6KIQi+511bF1hXajpfI8owVqIOClmgLOM6+++w9o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718094466; c=relaxed/simple; bh=S9etYCrjDhnD286GdZJel9VZyLYtyY1IIfEvrHkgZdk=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=UAdXdh8/ekI9CUs1XQO4tVV2YNE/MtgfNy2c/Td0LWs9rMtD6KwkMdMz9tm5BykP+gi6jwWR/bq7lkcXgC9sCD+w+WRYlLhFSBr9uB97BFBFk2SHnqhxFUk6GJx02PrzUck8VhAxs3qmDcjVUoJ632hPG1mAASbcar8979ZE6dI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=t-argos.ru; spf=pass smtp.mailfrom=t-argos.ru; dkim=pass (2048-bit key) header.d=t-argos.ru header.i=@t-argos.ru header.b=Kd07t7jM; arc=none smtp.client-ip=109.73.34.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=t-argos.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=t-argos.ru Received: from mx1.t-argos.ru (localhost [127.0.0.1]) by mx1.t-argos.ru (Postfix) with ESMTP id C2600100002; Tue, 11 Jun 2024 11:27:16 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=t-argos.ru; s=mail; t=1718094436; bh=oFr2YS8xOkbzW4Son0Mqyup2AFLMMw+xc2c2p9yDb7s=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Kd07t7jMBRIFed/W7eTPu1CdgJuCtfVSQNreUt0PqSJ1O3Ih5aRM3+1+MRpb4WnLr ukcuhYepphPn0jHijbkF9R9uwDgEUfD6xftTW2KsmpARvacqeP+a/hVlc+flbvxekL bMGvXEIoFMpCdJd0XF6jbb8hR6kAhErW5X2kyOKf4PcFNZLoW+1eEPYERvewqHcOXW wrqKPg68KIwfsC9KxL2NfNFv9iuIV1jfG77AXDhrzqbIoJR+hTg9MzN86LtAkcO5or nl1jZEq9sq+5FhoWbFko22nDCEbvz8pAK4UrxeN8ZBahfaoJ/WFRHVP5DIkrDKZdVi ZfGAcYcAeh2qQ== Received: from mx1.t-argos.ru.ru (ta-mail-02.ta.t-argos.ru [172.17.13.212]) by mx1.t-argos.ru (Postfix) with ESMTP; Tue, 11 Jun 2024 11:26:15 +0300 (MSK) Received: from localhost.localdomain (172.17.215.5) by ta-mail-02 (172.17.13.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 11 Jun 2024 11:25:54 +0300 From: Aleksandr Mishin To: Edwin Peer CC: Aleksandr Mishin , Michael Chan , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , , , , Wojciech Drewek Subject: [PATCH net v3] bnxt_en: Adjust logging of firmware messages in case of released token in __hwrm_send() Date: Tue, 11 Jun 2024 11:25:46 +0300 Message-ID: <20240611082547.12178-1-amishin@t-argos.ru> X-Mailer: git-send-email 2.30.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: ta-mail-02.ta.t-argos.ru (172.17.13.212) To ta-mail-02 (172.17.13.212) X-KSMG-Rule-ID: 1 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 185852 [Jun 11 2024] X-KSMG-AntiSpam-Version: 6.1.0.4 X-KSMG-AntiSpam-Envelope-From: amishin@t-argos.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 20 0.3.20 743589a8af6ec90b529f2124c2bbfc3ce1d2f20f, {Tracking_from_domain_doesnt_match_to}, 127.0.0.199:7.1.2;t-argos.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;mx1.t-argos.ru.ru:7.1.1, FromAlignment: s X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean, bases: 2024/06/11 07:24:00 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2024/06/11 05:58:00 #25560715 X-KSMG-AntiVirus-Status: Clean, skipped In case of token is released due to token->state == BNXT_HWRM_DEFERRED, released token (set to NULL) is used in log messages. This issue is expected to be prevented by HWRM_ERR_CODE_PF_UNAVAILABLE error code. But this error code is returned by recent firmware. So some firmware may not return it. This may lead to NULL pointer dereference. Adjust this issue by adding token pointer check. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 8fa4219dba8e ("bnxt_en: add dynamic debug support for HWRM messages") Suggested-by: Michael Chan Signed-off-by: Aleksandr Mishin Reviewed-by: Wojciech Drewek --- v1->v2: Preserve the error message by replacing 'token' with 'ctx->req->seq_id' as suggested by Michael. As the patch didn't change significantly, add Wojciech's Reviewed-by tag from the previous version. v2->v3: Fix missing alignment. drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c index 1df3d56cc4b5..d2fd2d04ed47 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c @@ -680,7 +680,7 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx) req_type); else if (rc && rc != HWRM_ERR_CODE_PF_UNAVAILABLE) hwrm_err(bp, ctx, "hwrm req_type 0x%x seq id 0x%x error 0x%x\n", - req_type, token->seq_id, rc); + req_type, le16_to_cpu(ctx->req->seq_id), rc); rc = __hwrm_to_stderr(rc); exit: if (token) -- 2.30.2