In the Linux kernel, the following vulnerability has been resolved:
ipc: fix to protect IPCS lookups using RCU
syzbot reported that it discovered a use-after-free vulnerability, [0]
idrforeach() is protected by rwsem, but this is not enough. If it is not protected by RCU read-critical region, when idrforeach() calls radixtreenodefree() through callrcu() to free the radixtreenode structure, the node will be freed immediately, and when reading the next node in radixtreeforeachslot(), the already freed memory may be read.
Therefore, we need to add code to make sure that idrforeach() is protected within the RCU read-critical region when we call it in shmdestroyorphaned().