Re: [PATCH net v3] bnxt_en: Adjust logging of firmware messages in case of released token in __hwrm_send()

From: Michael Chan
Date: Tue Jun 11 2024 - 12:40:01 EST


On Tue, Jun 11, 2024 at 1:28 AM Aleksandr Mishin <amishin@xxxxxxxxxx> wrote:
>
> 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 <michael.chan@xxxxxxxxxxxx>
> Signed-off-by: Aleksandr Mishin <amishin@xxxxxxxxxx>
> Reviewed-by: Wojciech Drewek <wojciech.drewek@xxxxxxxxx>
> ---
> 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.

Thanks.
Reviewed-by: Michael Chan <michael.chan@xxxxxxxxxxxx>

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature