Subject: CVE-2024-40919: bnxt_en: Adjust logging of firmware messages in case of released token in __hwrm_send()

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

bnxt_en: Adjust logging of firmware messages in case of released token in __hwrm_send()

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.

The Linux kernel CVE team has assigned CVE-2024-40919 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.17 with commit 8fa4219dba8e and fixed in 6.1.95 with commit cde177fa235c
	Issue introduced in 5.17 with commit 8fa4219dba8e and fixed in 6.6.35 with commit ca6660c95624
	Issue introduced in 5.17 with commit 8fa4219dba8e and fixed in 6.9.6 with commit 8b65eaeae88d
	Issue introduced in 5.17 with commit 8fa4219dba8e and fixed in 6.10 with commit a9b9741854a9

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-40919
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/cde177fa235cd36f981012504a6376315bac03c9
	https://git.kernel.org/stable/c/ca6660c956242623b4cfe9be2a1abc67907c44bf
	https://git.kernel.org/stable/c/8b65eaeae88d4e9f999e806e196dd887b90bfed9
	https://git.kernel.org/stable/c/a9b9741854a9fe9df948af49ca5514e0ed0429df