• Johan Hovold's avatar
    USB: cdc-acm: fix broken runtime suspend · ab05a2e4
    Johan Hovold authored
    commit 140cb81a 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>
    [bwh: Backported to 3.2: adjust context]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    ab05a2e4
cdc-acm.c 46.1 KB