r8152: prevent the driver from transmitting packets with carrier off
authorhayeswang <hayeswang@realtek.com>
Thu, 23 Mar 2017 11:14:19 +0000 (19:14 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Dec 2017 13:22:12 +0000 (14:22 +0100)
commit8ce4313f1279ce5aaa55ebb401a00efff9e299f6
treeb1b7564ac1876f2f8ccfb8d9258db0a13a5074f0
parent19b1ad3a2e682a78f6bd734350465c44e1d5c99b
r8152: prevent the driver from transmitting packets with carrier off

[ Upstream commit 2f25abe6bac573928a990ccbdac75873add8127e ]

The linking status may be changed when autosuspend. And, after
autoresume, the driver may try to transmit packets when the device
is carrier off, because the interrupt transfer doesn't update the
linking status, yet. And, if the device is in ALDPS mode, the device
would stop working.

The another similar case is
 1. unplug the cable.
 2. interrupt transfer queue a work_queue for linking change.
 3. device enters the ALDPS mode.
 4. a tx occurs before the work_queue is called.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/usb/r8152.c