mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <superm1@kernel.org>
To: Lizhi Hou <lizhi.hou@amd.com>,
	ogabbay@kernel.org, quic_jhugo@quicinc.com,
	dri-devel@lists.freedesktop.org,
	maciej.falkowski@linux.intel.com
Cc: Max Zhen <max.zhen@amd.com>,
	linux-kernel@vger.kernel.org, sonal.santan@amd.com
Subject: Re: [PATCH V1] accel/amdxdna: Guard management mailbox channel cleanup against NULL pointer
Date: Thu, 16 Apr 2026 17:46:00 -0500	[thread overview]
Message-ID: <be49ee67-ff32-4cbe-9fa8-6a3c626a948d@kernel.org> (raw)
In-Reply-To: <20260416201106.1046072-1-lizhi.hou@amd.com>



On 4/16/26 15:11, Lizhi Hou wrote:
> From: Max Zhen <max.zhen@amd.com>
> 
> The management mailbox channel cleanup helpers can be called from
> error handling paths when mgmt_chann has already been destroyed.
> 
> Add NULL checks to xdna_mailbox_free_channel() and
> xdna_mailbox_stop_channel() so the cleanup path safely returns instead
> of dereferencing a NULL mailbox channel pointer.
> 
> Fixes: b87f920b9344 ("accel/amdxdna: Support hardware mailbox")
> Signed-off-by: Max Zhen <max.zhen@amd.com>
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> ---
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
>   drivers/accel/amdxdna/amdxdna_mailbox.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/accel/amdxdna/amdxdna_mailbox.c b/drivers/accel/amdxdna/amdxdna_mailbox.c
> index 336e5e77f18a..37771bdb24a1 100644
> --- a/drivers/accel/amdxdna/amdxdna_mailbox.c
> +++ b/drivers/accel/amdxdna/amdxdna_mailbox.c
> @@ -496,6 +496,9 @@ struct mailbox_channel *xdna_mailbox_alloc_channel(struct mailbox *mb)
>   
>   void xdna_mailbox_free_channel(struct mailbox_channel *mb_chann)
>   {
> +	if (!mb_chann)
> +		return;
> +
>   	destroy_workqueue(mb_chann->work_q);
>   	kfree(mb_chann);
>   }
> @@ -542,6 +545,9 @@ void xdna_mailbox_stop_channel(struct mailbox_channel *mb_chann)
>   	struct mailbox_msg *mb_msg;
>   	unsigned long msg_id;
>   
> +	if (!mb_chann)
> +		return;
> +
>   	/* Disable an irq and wait. This might sleep. */
>   	free_irq(mb_chann->msix_irq, mb_chann);
>   


  reply	other threads:[~2026-04-16 22:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16 20:11 Lizhi Hou
2026-04-16 22:46 ` Mario Limonciello [this message]
2026-04-17 16:18   ` Lizhi Hou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be49ee67-ff32-4cbe-9fa8-6a3c626a948d@kernel.org \
    --to=superm1@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhi.hou@amd.com \
    --cc=maciej.falkowski@linux.intel.com \
    --cc=max.zhen@amd.com \
    --cc=ogabbay@kernel.org \
    --cc=quic_jhugo@quicinc.com \
    --cc=sonal.santan@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome