r8152: prevent the driver from transmitting packets with carrier off
commit60d59823046a7cfbfb6fe13ed9d320aafe1338a2
authorhayeswang <hayeswang@realtek.com>
Thu, 23 Mar 2017 11:14:19 +0000 (23 19:14 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Dec 2017 13:23:40 +0000 (25 14:23 +0100)
treed66c0a50b239b490e7f7a936f9a4c78141efb501
parentb89e229112c0277d73f41196c2b90397d4fdadd2
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