Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: illusion.wang@nebula-matrix.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	dimon.zhao@nebula-matrix.com, alvin.wang@nebula-matrix.com,
	sam.chen@nebula-matrix.com, netdev@vger.kernel.org,
	andrew+netdev@lunn.ch, corbet@lwn.net, horms@kernel.org,
	linux-doc@vger.kernel.org, pabeni@redhat.com,
	vadim.fedorenko@linux.dev, lukas.bulwahn@redhat.com,
	edumazet@google.com, enelsonmoore@gmail.com,
	skhan@linuxfoundation.org, hkallweit1@gmail.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v22 net-next 11/12] net/nebula-matrix: add common/ctrl dev init/remove operation
Date: Thu, 30 Jul 2026 18:30:36 -0700	[thread overview]
Message-ID: <20260731013036.745280-1-kuba@kernel.org> (raw)
In-Reply-To: <20260723040110.91410-12-illusion.wang@nebula-matrix.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
--- Patch [11]: [PATCH v22 net-next 11/12] net/nebula-matrix: add common/ctrl dev init/remove operation ---
commit 16bce0d3af6a82a0084a93157844e7c5875d3c59
Author: illusion wang <illusion.wang@nebula-matrix.com>

net/nebula-matrix: add common/ctrl dev init/remove operation

This commit adds initialization and teardown helpers for common and
control devices. It hooks these helpers into the main init/remove
paths and configures mailbox message processing via a work_struct.

> diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c b/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c
> new file mode 100644
> index 0000000000000..eae6a00e6fccb
> --- /dev/null
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c

[ ... ]

> +static int nbl_dev_setup_common_dev(struct nbl_adapter *adapter)
> +{

[ ... ]

> +	INIT_WORK(&common_dev->clean_mbx_task, nbl_dev_clean_mailbox_task);
> +	nbl_dev_register_chan_task(dev_mgt, NBL_CHAN_TYPE_MAILBOX,
> +				   &common_dev->clean_mbx_task);
> +	/*
> +	 * Even if has_ctrl=false (no dedicated control PF channel), we fetch
> +	 * VSI/ETH info via regular mailbox message  instead of
> +	 * dedicated control command.
> +	 */
> +	ret = disp_ops->get_vsi_id(priv, NBL_VSI_DATA, &common->vsi_id);

[Severity: High]
Will this mailbox message fail silently and read uninitialized zeros?

Since get_vsi_id() is called here before interrupts are enabled,
NBL_CHAN_INTERRUPT_READY is false. When nbl_chan_send_msg() processes
this message, it checks the interrupt ready flag:

if (test_bit(NBL_CHAN_INTERRUPT_READY, chan_info->state)) {
        spin_lock_irq(&wait_head->status_lock);
        while (!READ_ONCE(wait_head->acked)) {
                ...
        }
}
...
inflight_dec_out:
        atomic_dec(&chan_info->inflight_tx_cnt);
        return ret;

Because the flag is false, does it skip waiting for the ACK and immediately
return success (0)?

If so, this would leave the caller reading zeroed variables for the
VSI and ETH IDs, resulting in incorrect initialization and potentially leaving
a dangling pointer in the wait queue.

> +	if (ret)
> +		goto err_cleanup;
> +	ret = disp_ops->get_eth_id(priv, common->vsi_id, &common->eth_num,
> +			     &common->eth_id, &common->logic_eth_id);
> +	if (ret)
> +		goto err_cleanup;

[ ... ]

  reply	other threads:[~2026-07-31  1:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  4:00 [PATCH v22 net-next 00/12] nbl driver for Nebulamatrix NICs illusion.wang
2026-07-23  4:00 ` [PATCH v22 net-next 01/12] net/nebula-matrix: add minimum nbl build framework illusion.wang
2026-07-31  1:10   ` Jakub Kicinski
2026-07-23  4:00 ` [PATCH v22 net-next 02/12] net/nebula-matrix: add core driver architecture and HW layer initialization illusion.wang
2026-07-30  9:18   ` 回复:[PATCH " Illusion Wang
2026-07-31  1:13   ` [PATCH " Jakub Kicinski
2026-07-31  1:30   ` Jakub Kicinski
2026-07-23  4:00 ` [PATCH v22 net-next 03/12] net/nebula-matrix: add channel wire opcode enum definitions illusion.wang
2026-07-23  4:00 ` [PATCH v22 net-next 04/12] net/nebula-matrix: add channel layer illusion.wang
2026-07-31  1:27   ` Jakub Kicinski
2026-07-31  1:30   ` Jakub Kicinski
2026-07-23  4:00 ` [PATCH v22 net-next 05/12] net/nebula-matrix: add common resource implementation illusion.wang
2026-07-31  1:30   ` Jakub Kicinski
2026-07-23  4:00 ` [PATCH v22 net-next 06/12] net/nebula-matrix: add intr " illusion.wang
2026-07-31  1:30   ` Jakub Kicinski
2026-07-23  4:00 ` [PATCH v22 net-next 07/12] net/nebula-matrix: add chip-wide hardware init/deinit implementation illusion.wang
2026-07-31  1:30   ` Jakub Kicinski
2026-07-23  4:01 ` [PATCH v22 net-next 08/12] net/nebula-matrix: dispatch: add control-level routing core infrastructure illusion.wang
2026-07-23  4:01 ` [PATCH v22 net-next 09/12] net/nebula-matrix: dispatch: add cross-version channel message framework illusion.wang
2026-07-31  1:30   ` Jakub Kicinski
2026-07-23  4:01 ` [PATCH v22 net-next 10/12] net/nebula-matrix: dispatch: add mutual exclusion lock for shared hardware resource ops illusion.wang
2026-07-31  1:30   ` Jakub Kicinski
2026-07-23  4:01 ` [PATCH v22 net-next 11/12] net/nebula-matrix: add common/ctrl dev init/remove operation illusion.wang
2026-07-31  1:30   ` Jakub Kicinski [this message]
2026-07-23  4:01 ` [PATCH v22 net-next 12/12] net/nebula-matrix: add common dev start/stop operation illusion.wang
2026-07-31  1:30   ` Jakub Kicinski
2026-07-31  1:29 ` [PATCH v22 net-next 00/12] nbl driver for Nebulamatrix NICs Jakub Kicinski

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=20260731013036.745280-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=alvin.wang@nebula-matrix.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=dimon.zhao@nebula-matrix.com \
    --cc=edumazet@google.com \
    --cc=enelsonmoore@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=illusion.wang@nebula-matrix.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sam.chen@nebula-matrix.com \
    --cc=skhan@linuxfoundation.org \
    --cc=vadim.fedorenko@linux.dev \
    /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