]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
netdevsim: psp: rcu protect psp_dev reference
authorDaniel Zahka <daniel.zahka@gmail.com>
Tue, 5 May 2026 10:42:25 +0000 (03:42 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 7 May 2026 00:39:20 +0000 (17:39 -0700)
commit07bdec3fc737aac7f4c273aafa803d353174c43e
treea256a46bc8fc92a5ee81952c40f6582e8c61a09d
parent24c96a42006ee27a078ec8c631c906dea8a3ca6d
netdevsim: psp: rcu protect psp_dev reference

There are two issues with the way psp_dev is used in nsim_do_psp():

1. There is no check for IS_ERR() on the peers psp_dev, before
   dereferencing.
2. The refcount on this psp_dev can be dropped by
   nsim_psp_rereg_write()

To fix this, we can make netdevsim's reference to its psp_dev an rcu
reference, and then nsim_do_psp() can read the fields it needs from an
rcu critical section.

Fixes: f857478d6206 ("netdevsim: a basic test PSP implementation")
Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260505-psd-rcu-v1-3-a8f69ec1ab96@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/netdevsim/netdevsim.h
drivers/net/netdevsim/psp.c