Skip to content

Commit 15d2530

Browse files
dmantipovjeff-t-johnson
authored andcommitted
wifi: carl9170: do not ping device which has failed to load firmware
Syzkaller reports [1, 2] crashes caused by an attempts to ping the device which has failed to load firmware. Since such a device doesn't pass 'ieee80211_register_hw()', an internal workqueue managed by 'ieee80211_queue_work()' is not yet created and an attempt to queue work on it causes null-ptr-deref. [1] https://syzkaller.appspot.com/bug?extid=9a4aec827829942045ff [2] https://syzkaller.appspot.com/bug?extid=0d8afba53e8fb2633217 Fixes: e4a668c ("carl9170: fix spurious restart due to high latency") Signed-off-by: Dmitry Antipov <[email protected]> Acked-by: Christian Lamparter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]>
1 parent ad5e917 commit 15d2530

File tree

1 file changed

+13
-6
lines changed
  • drivers/net/wireless/ath/carl9170

1 file changed

+13
-6
lines changed

drivers/net/wireless/ath/carl9170/usb.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,21 @@ static void carl9170_usb_rx_complete(struct urb *urb)
438438

439439
if (atomic_read(&ar->rx_anch_urbs) == 0) {
440440
/*
441-
* The system is too slow to cope with
442-
* the enormous workload. We have simply
443-
* run out of active rx urbs and this
444-
* unfortunately leads to an unpredictable
445-
* device.
441+
* At this point, either the system is too slow to
442+
* cope with the enormous workload (so we have simply
443+
* run out of active rx urbs and this unfortunately
444+
* leads to an unpredictable device), or the device
445+
* is not fully functional after an unsuccessful
446+
* firmware loading attempts (so it doesn't pass
447+
* ieee80211_register_hw() and there is no internal
448+
* workqueue at all).
446449
*/
447450

448-
ieee80211_queue_work(ar->hw, &ar->ping_work);
451+
if (ar->registered)
452+
ieee80211_queue_work(ar->hw, &ar->ping_work);
453+
else
454+
pr_warn_once("device %s is not registered\n",
455+
dev_name(&ar->udev->dev));
449456
}
450457
} else {
451458
/*

0 commit comments

Comments
 (0)