Re: nwbutton: lost wakeup in button_read() -- worth fixing, or is this driver done?
From: Greg KH
Date: Sat Aug 22 2026 - 12:11:02 EST
On Sat, Aug 22, 2026 at 06:06:13PM +0200, Greg KH wrote:
> On Sat, Aug 22, 2026 at 11:01:38AM -0500, old king wrote:
> > Hi,
> >
> > button_read() in drivers/char/nwbutton.c sleeps unconditionally: nothing is
> > tested before schedule(), not even whether the buffer is empty. If
> > button_sequence_finished() wakes button_wait_queue in the window between
> > read() being entered and prepare_to_wait() queuing the reader, that wakeup
> > is lost and the reader sleeps until some later, unrelated button sequence
> > completes. The race predates commit eb831743f2b4, whose changelog already called
> > the code "inherently racy". I have reproduced it under QEMU and prepared a fix:
> > a sequence counter captured before queuing and re-checked after.
> >
> > Before I send that: is this driver still worth fixing? footbridge is
> > deprecated and its Kconfig says support goes away in 2027 unless remaining
> > users speak up. Every change to nwbutton.c in git history has been a
> > treewide cleanup rather than anything a user asked for, and
> > button_add_callback()/button_del_callback() have no callers in the tree. I
> > have no NetWinder hardware and no way to tell whether anyone else does.
>
> If you don't have the hardware to test it, don't worry about the driver
> at all.
I don't think it can even build, given that there is no definition for
machine_is_netwinder() anywhere in the tree that I can see. So maybe
many of these drivers can just be removed now. Arnd, any ideas?
thanks,
greg k-h