Commit 5bcbc3fcbd88842765aa419934602d3930c6ed3c
Committed by
John W. Linville
1 parent
9c371f9973
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
carl9170: fix sleep in softirq context
This patch fixes the following bug: usb 1-1.1: restart device (8) BUG: sleeping function called from invalid context at drivers/usb/core/urb.c:654 in_atomic(): 1, irqs_disabled(): 0, pid: 0, name: swapper (usb_poison_urb+0x1c/0xf8) (usb_poison_anchored_urbs+0x48/0x78) (carl9170_usb_handle_tx_err+0x128/0x150) (carl9170_usb_reset+0xc/0x20) (carl9170_handle_command_response+0x298/0xea8) (carl9170_usb_tasklet+0x68/0x184) (tasklet_hi_action+0x84/0xdc) this only happens if the device is plugged in an USB port, the driver is loaded but inactive (e.g. the wlan interface is down). If the device is active everything is fine. Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com> Signed-off-by: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Showing 2 changed files with 15 additions and 15 deletions Side-by-side Diff
drivers/net/wireless/ath/carl9170/carl9170.h
drivers/net/wireless/ath/carl9170/main.c
... | ... | @@ -465,27 +465,26 @@ |
465 | 465 | { |
466 | 466 | struct ar9170 *ar = container_of(work, struct ar9170, |
467 | 467 | restart_work); |
468 | - int err; | |
468 | + int err = -EIO; | |
469 | 469 | |
470 | 470 | ar->usedkeys = 0; |
471 | 471 | ar->filter_state = 0; |
472 | 472 | carl9170_cancel_worker(ar); |
473 | 473 | |
474 | 474 | mutex_lock(&ar->mutex); |
475 | - err = carl9170_usb_restart(ar); | |
476 | - if (net_ratelimit()) { | |
477 | - if (err) { | |
478 | - dev_err(&ar->udev->dev, "Failed to restart device " | |
479 | - " (%d).\n", err); | |
480 | - } else { | |
481 | - dev_info(&ar->udev->dev, "device restarted " | |
482 | - "successfully.\n"); | |
475 | + if (!ar->force_usb_reset) { | |
476 | + err = carl9170_usb_restart(ar); | |
477 | + if (net_ratelimit()) { | |
478 | + if (err) | |
479 | + dev_err(&ar->udev->dev, "Failed to restart device (%d).\n", err); | |
480 | + else | |
481 | + dev_info(&ar->udev->dev, "device restarted successfully.\n"); | |
483 | 482 | } |
484 | 483 | } |
485 | - | |
486 | 484 | carl9170_zap_queues(ar); |
487 | 485 | mutex_unlock(&ar->mutex); |
488 | - if (!err) { | |
486 | + | |
487 | + if (!err && !ar->force_usb_reset) { | |
489 | 488 | ar->restart_counter++; |
490 | 489 | atomic_set(&ar->pending_restarts, 0); |
491 | 490 | |
... | ... | @@ -526,10 +525,10 @@ |
526 | 525 | if (!ar->registered) |
527 | 526 | return; |
528 | 527 | |
529 | - if (IS_ACCEPTING_CMD(ar) && !ar->needs_full_reset) | |
530 | - ieee80211_queue_work(ar->hw, &ar->restart_work); | |
531 | - else | |
532 | - carl9170_usb_reset(ar); | |
528 | + if (!IS_ACCEPTING_CMD(ar) || ar->needs_full_reset) | |
529 | + ar->force_usb_reset = true; | |
530 | + | |
531 | + ieee80211_queue_work(ar->hw, &ar->restart_work); | |
533 | 532 | |
534 | 533 | /* |
535 | 534 | * At this point, the device instance might have vanished/disabled. |