• Johan Hovold's avatar
    USB: cdc-acm: fix broken runtime suspend · 140cb81a
    Johan Hovold authored
    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>
    Cc: <stable@vger.kernel.org>	# v2.6.27
    Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    140cb81a
cdc-acm.c 50.5 KB