Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp383645lqp; Sun, 9 Jun 2024 00:03:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWeCCaeE9RIkdPJviCgXirAH67ohy5m0kFjPaQ7uo16eUE3syDMY/stuino4FOl4JiFj0zhqLJZqHKKahc+ndN++ynEeI2Sp2ROIIo74g== X-Google-Smtp-Source: AGHT+IGSPrTRq6M45N7nEtw6cQGFdebZnuWFTE/6pzJSDwICepue6ZBFSZix9M1sNEv0l4yrti7B X-Received: by 2002:a05:6870:a9a9:b0:250:171d:5c74 with SMTP id 586e51a60fabf-2546457fbf9mr8036488fac.26.1717916637679; Sun, 09 Jun 2024 00:03:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717916637; cv=pass; d=google.com; s=arc-20160816; b=a2K1D5wgaswwjFM66BUgYQcteTUu9/IyTIouBCeNprl2qZb4p3ShWymb6dJwIIxbUU nNxMcz/6MFc4aFt0+kpSrCjI/fnwZD8KClqhtFBf5aRwnxpBy7we6dXWF6uPIrNvnoOc Y4G16r4wkTSus/kx20q3GP7CE1QiTMFSkZRkT2V8wjZdUoBXP5PdfzkkMwdRZxxvz4pe xbbkNugayA4Ekt653af2RRUu3toH+Klpvcsn0TCYeqvA25hs7A2tXmbobRmCBMxPo8IA U1t3SWRRpT/YeDdF2hDuukh440VeoQ/HCjV3tTu1aGqgkVtXbqNqfWxe/xEdlNYJDKEp 2UZA== 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=AyHJoAgjcoBVULg49ijh2T3fkhZTkVF+LRZzusXaTYg=; fh=RQID1kRYHBRV041WnK18puLmO9Qg4dSb1lH1G+clEbk=; b=VSFyAgVQF08SXbTJG8GkN46vs5Shs4MI2D8YvlO8dxEyDOms7JAtj3AMTowLgSnGLj M/ToUFgQeZ4taO1AHpD1aDvK1ZE9cOlaY/9Y3WEJsVAiVgku/cwmVKsJS0c6sXE46e47 LST/z1U6lDbhon0uu8Ha0yw6elUem5rQ9qaiS11zKgx0VgSz+gxd0VPPta+ch1vqvQ9i 62oyDxeNYg3GrFjA5+RmN736y748GLN4UbMGt0MQ2B58WOa9j3LZR6x+UpRp8Q/cFeTg G9g8pZQ8D1aAXETd3dwF+bY2QycRi70C7hS7W9y5eAgwUlqU0pl0ATlsKE49KaAoDN0y aM0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@t-argos.ru header.s=mail header.b=R7gKVuSY; 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-207258-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207258-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 ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-795601e0e64si69466685a.113.2024.06.09.00.03.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 00:03:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207258-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@t-argos.ru header.s=mail header.b=R7gKVuSY; 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-207258-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207258-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 497191C20A6F for ; Sun, 9 Jun 2024 07:03:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 50DC617C95; Sun, 9 Jun 2024 07:03:50 +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="R7gKVuSY" 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 16F73F9E4; Sun, 9 Jun 2024 07:03:41 +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=1717916628; cv=none; b=sxMCKp1gguXiScSHIeHP9h78iXbxPA1imyDBg+6X6A/Rtm1H+fLNtv0HQArJZOHrRnofb5XiGzKycyapXa+j5BWtszVqsPbLQ4TL6OQWDtgijmstpQZxP1Vu3RpFL0fvEeTMTS7Gi21pKfJN5FMbT3AQq4PGtj7HLiTVq5SJmDY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717916628; c=relaxed/simple; bh=G5jo3zUfH0rx0gxNk/gy1V61RaR8N0DTrBTT+oe6hsE=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=o4gHfTCSFnWMFE8JRNT93NPQCPGvlKX8nubnrCb4OSWSYzV4mhmlEh7Vnks5kKvrmkXpfElLMu8A9a3+xeVgC5YX2nmgVPd9Muhq62hUezYn++70VInsodX/BAeSYz2KjsxAxGjHN4+Qqa5FiDNlPDFnxf2rvm+Em+/jtAm60UU= 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=R7gKVuSY; 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 B3663100002; Sun, 9 Jun 2024 10:03:17 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=t-argos.ru; s=mail; t=1717916597; bh=AyHJoAgjcoBVULg49ijh2T3fkhZTkVF+LRZzusXaTYg=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=R7gKVuSY45ptuCvbTSVZa6l7/tWbVKtXPVjo5UypK0tfPVLP4ueQonMq66NL05izr QuxrqtH0NaIbqjQ6aX9++TgfkFdCDOm2+H6P2RSY9/S8opTLDxKBF9Ydl90rEsQ9i9 HG4eC/4upQ2zma79PoHeZrnLEHZdPCW4R6nwnlorvjlKjKaCW5ltouaXHadomRPr0k G+oycShEil/N0bvDWfp7OPzEjS34OfztaV5/YPG333O7WqJQ9AsGT3nJPgAbNxtC83 qtonRXOEVgX6Vr4UPSkCS+adWrHZ4iun8SYufkEXKmJ1zIsG6mDFcOJs5W6ONLe7Dd LbLj5Ko10Vycg== 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; Sun, 9 Jun 2024 10:02:15 +0300 (MSK) Received: from localhost.localdomain (172.17.215.6) 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; Sun, 9 Jun 2024 10:01: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 v2] bnxt_en: Adjust logging of firmware messages in case of released token in __hwrm_send() Date: Sun, 9 Jun 2024 10:01:29 +0300 Message-ID: <20240609070129.12364-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: 185814 [Jun 08 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}, mx1.t-argos.ru.ru:7.1.1;t-argos.ru:7.1.1;127.0.0.199:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com: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/09 02:52:00 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2024/06/09 04:46:00 #25519876 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. 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..67d0ba8869f4 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