On Wed Nov 18, 2026 at 1:05 AM EST, netdev-bot+sashiko wrote:
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The new PSP_ASSOC_DEFER_TX_KEY_DEL path in `psp_assoc_free()`
(net/psp/psp_sock.c:118-121) gives up its only psd reference before…
- [Medium] Removing the SADB check in `psp_sock_tx_rekey()` lets any non-
admin user who can reach the PSP device rekey one established TCP…
- [Low] The commit message never says that this patch turns on Tx rekey
for SADB devices.
- [Low] The patch adds a lock-context rule for SADB drivers that only the
commit message states: they must not call `psp_dev_unregister()` with…
--
psp: defer tx key deletions for SADB drivers
This commit adds a deferred deletion queue for Tx keys on SADB devices.
A key detached by a Tx rekey is removed from the device only after a
BQL-based descriptor grace period, which a delayed work item checks by
snapshotting per-queue num_queued and polling num_completed. It also
makes INET_PSP depend on BQL, requires ops-locked netdevs for SADB
drivers, and drops the check that rejected Tx rekey on SADB devices.
quoted
diff --git a/Documentation/networking/psp.rst b/Documentation/networking/psp.rst
index 43f222b38d3d4..ceb1e232317fc 100644
--- a/Documentation/networking/psp.rst
+++ b/Documentation/networking/psp.rst
@@ -202,6 +202,48 @@ Drivers must use ``psp_skb_get_assoc_rcu()`` to check if PSP Tx offload
[ ... ]
quoted
+* Before calling ``psp_dev_unregister()``, the driver must ensure that all
+ outstanding Tx descriptors containing key references have been completed
+ or discarded. PSP core deletes all remaining Tx keys during
+ unregistration without waiting for a grace period.
[Severity: Low]
Should this list also say that psp_dev_unregister() must not be called
with the netdev instance lock held? The commit message states that rule.
It is not in this list or in the psp_dev_unregister() kernel-doc, and
nothing asserts it.
psp_dev_unregister() now starts with:
psp_dev_unregister()
psp_deferred_del_stop()
disable_delayed_work_sync(&psd->tx_del.work)
and psp_deferred_del_work() takes the locks in this order:
mutex_lock(&psd->lock);
netdev_lock(psd->main_netdev);
Suppose a driver calls psp_dev_unregister() while holding
main_netdev->lock, and the work is blocked in netdev_lock(). Wouldn't
disable_delayed_work_sync() then wait forever?
Even with the work idle, the later mutex_lock(&psd->lock) in
psp_dev_unregister() would run under the netdev lock. That inverts the
lock order the work uses.
mlx5 complies today, because mlx5e_nic_disable() drops the netdev lock
before mlx5e_psp_unregister().
Could the rule go in this list with the other requirements? Something
like lockdep_assert_not_held(&psd->main_netdev->lock) in
psp_dev_unregister() would also match the ops-lock WARN_ON check in
psp_dev_create().
[ ... ]
quoted
diff --git a/net/psp/psp_sock.c b/net/psp/psp_sock.c
index d497f41c483e1..48bffe088c79b 100644
--- a/net/psp/psp_sock.c
+++ b/net/psp/psp_sock.c
@@ -114,8 +114,14 @@ static void psp_assoc_free(struct work_struct *work)
mutex_lock(&psd->lock);
if (psp_dev_is_registered(psd)) {
- if (psp_assoc_needs_tx_key_del(pas))
+ if (psp_assoc_needs_tx_key_del(pas)) {
+ if (pas->flags & PSP_ASSOC_DEFER_TX_KEY_DEL) {
+ psp_deferred_del_queue(psd, pas);
+ mutex_unlock(&psd->lock);
+ return;
+ }
[Severity: Medium]
Once pas is on psd->tx_del.next, its psd reference belongs to the
deferred queue. This path keeps no reference of its own across
mutex_unlock(&psd->lock). Can psd be torn down while this thread is
still inside mutex_unlock()?
Documentation/locking/mutex-design.rst says mutex_unlock() may access the
mutex after releasing ownership, so the caller has to keep the mutex
alive until it returns. When there is a waiter, __mutex_unlock_slowpath()
releases ownership and then still takes lock->wait_lock and calls
debug_mutex_unlock(lock).
A possible sequence:
CPU1 (psp_assoc_free work) CPU2 (psp_dev_unregister)
psp_deferred_del_queue(psd, pas)
mutex_unlock(&psd->lock) mutex_lock(&psd->lock) succeeds
still in slowpath psp_deferred_del_uninit()
psp_dev_put(psd)
mutex_unlock(&psd->lock)
psp_dev_put(psd)
psp_dev_free()
mutex_destroy(&psd->lock)
kfree_rcu(psd, rcu)
debug_mutex_unlock(lock)
Ah TIL. I was a bit naive that mutex_unlock() can still be running while
the next waiter enters the critical section.
pw-bot: cr