Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] net: psp: use psp_dev_is_registered() in psp_assoc_free()
@ 2026-08-14 11:44 Daniel Zahka
  2026-08-17 19:45 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Zahka @ 2026-08-14 11:44 UTC (permalink / raw)
  To: Jakub Kicinski, Willem de Bruijn, David S. Miller, Eric Dumazet,
	Paolo Abeni, Simon Horman
  Cc: netdev, linux-kernel

No functional changes.

In code paths that use a psp_dev reference that wasn't obtained from
the psp_devs xarray, e.g. not via psp_device_get_and_lock(), there is
no guarantee that the psp_dev has not been unregistered. The check
here is correct, but it doesn't match other code paths that use
psp_dev_is_registered().

Commit b89769f936a8 ("net: psp: check for device unregister when
creating assoc") is an example of a fix that adds a check for this
after locking a psp_dev. if (psp_dev_is_registered(psd)) vs if
(psd->ops) makes it clear what we are really checking for.

Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
---
 net/psp/psp_sock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/psp/psp_sock.c b/net/psp/psp_sock.c
index 07dc4cf741f3..1a2a6b7516b0 100644
--- a/net/psp/psp_sock.c
+++ b/net/psp/psp_sock.c
@@ -96,7 +96,7 @@ static void psp_assoc_free(struct work_struct *work)
 	struct psp_dev *psd = pas->psd;
 
 	mutex_lock(&psd->lock);
-	if (psd->ops)
+	if (psp_dev_is_registered(psd))
 		psp_dev_tx_key_del(psd, pas);
 	mutex_unlock(&psd->lock);
 	psp_dev_put(psd);

---
base-commit: 4f93b12cf7b25fbf8e73d222722805b049f0a6d3
change-id: 20260814-psp-dev-is-reg-21bc63648558

Best regards,
-- 
Daniel Zahka <daniel.zahka@gmail.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: psp: use psp_dev_is_registered() in psp_assoc_free()
  2026-08-14 11:44 [PATCH net-next] net: psp: use psp_dev_is_registered() in psp_assoc_free() Daniel Zahka
@ 2026-08-17 19:45 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-17 19:45 UTC (permalink / raw)
  To: Daniel Zahka
  Cc: kuba, willemdebruijn.kernel, davem, edumazet, pabeni, horms,
	netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 14 Aug 2026 04:44:06 -0700 you wrote:
> No functional changes.
> 
> In code paths that use a psp_dev reference that wasn't obtained from
> the psp_devs xarray, e.g. not via psp_device_get_and_lock(), there is
> no guarantee that the psp_dev has not been unregistered. The check
> here is correct, but it doesn't match other code paths that use
> psp_dev_is_registered().
> 
> [...]

Here is the summary with links:
  - [net-next] net: psp: use psp_dev_is_registered() in psp_assoc_free()
    https://git.kernel.org/netdev/net-next/c/cf85f810f911

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-17 19:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 11:44 [PATCH net-next] net: psp: use psp_dev_is_registered() in psp_assoc_free() Daniel Zahka
2026-08-17 19:45 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox