From: sashiko-bot@kernel.org
To: "Ratheesh Kannoth" <rkannoth@marvell.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v18 net-next 2/2] octeontx2: add mqprio bandwidth offload for NIX TX schedulers
Date: Wed, 30 Sep 2026 02:30:16 +0000 [thread overview]
Message-ID: <20260930023016.BF89B1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260929022915.2704627-3-rkannoth@marvell.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] tc: use-after-free in otx2_mqprio_netdev_tc_work due to premature work cancellation
- [Medium] tc: mqprio offload state leak blocks future channel configuration
--
commit c282f822793fe3053caf590664f822dd8c83b2e9
Author: Ratheesh Kannoth <rkannoth@marvell.com>
octeontx2: add mqprio bandwidth offload for NIX TX schedulers
This commit adds TC_SETUP_QDISC_MQPRIO offload with
TC_MQPRIO_SHAPER_BW_RATE on PF and VF netdevs. It programs per-queue MDQ
CIR/PIR via the NIX TX scheduler mailbox and introduces a work item for
restoring TC configurations.
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
[ ... ]
> @@ -287,6 +287,21 @@ static int otx2_set_channels(struct net_device *dev,
> return -EINVAL;
> }
>
> + if (pfvf->mqprio.rate_limit &&
> + (channel->tx_count != pfvf->hw.tx_queues ||
> + channel->rx_count != pfvf->hw.rx_queues)) {
> + netdev_info(dev,
> + "Not permitted to change channel count while MQ prio is active\n");
> + return -EINVAL;
> + }
> +
> + if ((pfvf->old_mq_snap || pfvf->cur_mq_snap) &&
> + channel->tx_count < pfvf->hw.tx_queues) {
> + netdev_err(dev,
> + "Cannot reduce TX queues after mqprio bandwidth offload was configured\n");
> + return -EINVAL;
> + }
[Severity: Medium]
Because pfvf->old_mq_snap is never cleared upon qdisc deletion (as seen
in otx2_mqprio_clear_sw below), will this permanently block reducing TX
queues via ethtool until the driver is reloaded?
[ ... ]
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
[ ... ]
> @@ -3622,7 +3641,9 @@ static void otx2_remove(struct pci_dev *pdev)
> otx2_cgx_config_linkevents(pf, false);
>
> otx2_unregister_dl(pf);
> + otx2_shutdown_tc_mqprio(pf);
> unregister_netdev(netdev);
[Severity: High]
Could calling otx2_shutdown_tc_mqprio() before unregister_netdev() lead
to a use-after-free?
Concurrent netlink operations might queue work via
otx2_mqprio_defer_netdev_tc_restore() while waiting on rtnl_lock(). Once
the remove path finishes unregistering and frees the netdev, the deferred
work could execute, access the freed pfvf->netdev, and corrupt memory.
[ ... ]
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
[ ... ]
> +static void otx2_mqprio_clear_sw(struct otx2_nic *pfvf)
> +{
> + struct net_device *netdev = pfvf->netdev;
> +
> + pfvf->mqprio.rate_limit = false;
> + otx2_mqprio_clear_replace_state(pfvf);
> + if (!otx2_mqprio_keep_netdev_tc(pfvf))
> + netdev_set_num_tc(netdev, 0);
> + otx2_mqprio_free_cache(pfvf);
> +}
[Severity: Medium]
Will this leak pfvf->old_mq_snap when the qdisc is deleted? The teardown
path clears the software state by calling otx2_mqprio_clear_sw(), but
neither this function nor otx2_teardown_tc_mqprio() frees the snapshot.
[ ... ]
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
[ ... ]
> @@ -840,7 +841,9 @@ static void otx2vf_remove(struct pci_dev *pdev)
> #endif
>
> otx2_unregister_dl(vf);
> + otx2_shutdown_tc_mqprio(vf);
> unregister_netdev(netdev);
[Severity: High]
Does this exhibit the same use-after-free risk as the PF remove path
above, where pending tc setup work could be deferred and executed after
unregister_netdev() has completed?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260929022915.2704627-1-rkannoth@marvell.com?part=2
next prev parent reply other threads:[~2026-09-30 2:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 2:29 [PATCH v18 net-next 0/2] octeontx2: mqprio bandwidth offload for NIX TX schedulers Ratheesh Kannoth
2026-09-29 2:29 ` [PATCH v18 net-next 1/2] octeontx2: use atomic bitops for PF/VF and rep flags Ratheesh Kannoth
2026-09-30 2:30 ` sashiko-bot
2026-10-02 8:31 ` netdev-bot+sashiko
2026-10-05 4:16 ` Ratheesh Kannoth
2026-09-29 2:29 ` [PATCH v18 net-next 2/2] octeontx2: add mqprio bandwidth offload for NIX TX schedulers Ratheesh Kannoth
2026-09-30 2:30 ` sashiko-bot [this message]
2026-10-02 8:31 ` netdev-bot+sashiko
2026-10-02 1:22 ` [PATCH v18 net-next 0/2] octeontx2: " Jakub Kicinski
2026-10-02 9:37 ` David Laight
2026-10-05 2:58 ` Ratheesh Kannoth
2026-10-05 8:14 ` David Laight
2026-10-05 9:49 ` Ratheesh Kannoth
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=20260930023016.BF89B1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=rkannoth@marvell.com \
--cc=sashiko-reviews@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.