[PATCH] RDMA/core: Fix slab-use-after-free in kernfs_find_ns()

From: Habil Eren Türker

Date: Tue Nov 24 2026 - 14:40:11 EST


Hi,

Tested with CONFIG_KASAN=y, CONFIG_PROVE_LOCKING=y, CONFIG_LOCKDEP=y
and CONFIG_RDMA_RXE=y on QEMU with -smp 4, using the syzbot reproducer.

Without the patch (pre-c41d577ac525), the reproducer reliably triggers
a KASAN slab-use-after-free in the device_del() path (observed in
kobject_uevent_env, reading a uevent_net that was freed by cleanup_net
in a racing netns teardown).

With the patch applied, the same reproducer over 10 iterations of the
rxe0 add/del + netns teardown race shows no KASAN splat and no lockdep
warning.

Regards,
Türker