• Oliver Neukum's avatar
    [PATCH] USB: fixes of assumptions about waitqueues · ec0e3558
    Oliver Neukum authored
    quoting Linus:
    
    --
    > so there is no need to recheck the bit in do/while loop, because
    > there is no false wakeups now.
    
    You should never assume this. You should assume that there are _always_
    false wakeups.
    
    Why? Because Linux has always allowed people to leave wait-queues active,
    without being "atomic". For example, the tty read/write layer used to
    (still does?)  add itself on the wait-queue _once_, and then leave itself
    on the wait-queue while in a loop it does copies from/to user space.
    --
    
    Unfortunately, this means us. Here's the first fix. Comments?
    
      - make sure timeouts are observed even if somebody left us on a queue
    ec0e3558
mdc800.c 23.3 KB