diff options
author | hayeswang | 2015-01-09 10:26:36 +0800 |
---|---|---|
committer | David S. Miller | 2015-01-12 16:10:22 -0500 |
commit | ef827a5b578c4255043a0c0032c88799fb4a774b (patch) | |
tree | 6e5d7fc4695dcdc621efab65ba4688ed2c19ecc7 /drivers/net/usb | |
parent | aa2e092671c84b149ba0f9ad7185ace357fb4a33 (diff) |
r8152: check the status before submitting rx
Don't submit the rx if the device is unplugged, stopped, or
linking down.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/r8152.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index cd9338837ce6..b23426e4952c 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1789,6 +1789,11 @@ int r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg, gfp_t mem_flags) { int ret; + /* The rx would be stopped, so skip submitting */ + if (test_bit(RTL8152_UNPLUG, &tp->flags) || + !test_bit(WORK_ENABLE, &tp->flags) || !netif_carrier_ok(tp->netdev)) + return 0; + usb_fill_bulk_urb(agg->urb, tp->udev, usb_rcvbulkpipe(tp->udev, 1), agg->head, agg_buf_sz, (usb_complete_t)read_bulk_callback, agg); |