Skip to content
  • Johan Hovold's avatar
    USB: cdc-acm: fix broken runtime suspend · 67e8477b
    Johan Hovold authored
    commit 140cb81ac8c625942a1d695875932c615767a526 upstream.
    
    The current ACM runtime-suspend implementation is broken in several
    ways:
    
    Firstly, it buffers only the first write request being made while
    suspended -- any further writes are silently dropped.
    
    Secondly, writes being dropped also leak write urbs, which are never
    reclaimed (until the device is unbound).
    
    Thirdly, even the single buffered write is not cleared at shutdown
    (which may happen before the device is resumed), something which can
    lead to another urb leak as well as a PM usage-counter leak.
    
    Fix this by implementing a delayed-write queue using urb anchors and
    making sure to discard the queue properly at shutdown.
    
    Fixes: 11ea859d
    
     ("USB: additional power savings for cdc-acm devices
    that support remote wakeup")
    
    Reported-by: default avatarXiao Jin <jin.xiao@intel.com>
    Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    67e8477b