On Wed, May 17, 2023 at 12:26 PM Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > Also note that this does NOT fix the incorrect RCU walks. .. this is the patch that I think should go on top of it to fix the misleading "safe" and the incorrect RCU walk. NOTE! This adds that lockdep_assert_held(&event_mutex); to user_event_enabler_update() too. It's already there in user_event_enabler_write(), but I'm not actually convinced this has gotten enough coverage checking, so I also did it in that caller. Some callers obviously hold that mutex. Others are much less obvious, eg that user_event_reg() -> update_enable_bit_for() chain. I *assume* all the 'class->reg()' callers get the event mutex, but I did not in any way check that it is true. So that lockdep annotation should be actually *tested* with lockdep enabled and somebody doing all these operations. Final note: I do not know this code *AT*ALL*. I'm literally just going by "this is the only correct coding pattern to use", not by some deeper understanding of what the code actually wants to do. Linus