Re: [PATCH] hwmon: (corsair-psu) serialize debugfs access against hwmon
From: Ali Ahmet Memis
Date: Tue Aug 04 2026 - 06:23:12 EST
> the next command's reinit_completion() re-arms the guard at the top of
> raw_event, and that stale reply is taken as the answer to the new command
Correcting myself on the mechanism, since it changes what a fix has to do.
reinit_completion() is not what defeats that guard. completion_done() is
just x->done != 0, and x->done is zero in every state between commands: a
successful wait_for_completion_timeout() decrements it back to zero, and a
timeout leaves it at zero because it was never set. So the check at the top
of raw_event practically never rejects anything, and reinit_completion() on
the next command writes zero over a value that is already zero.
The outcome I described is the same, a late reply still lands in cmd_buffer
and completes the next waiter with the previous command's data. But that
check is not a "command in flight" flag and cannot be turned into one by
moving it around, so whatever fixes this needs a way to tell which command a
reply actually belongs to.