ARM: Workaround to have NULL pointer problem with 15.3.1 wilc3000 firmware
authorJosep Orga <jorga@somdevices.com>
Tue, 14 Apr 2020 09:41:52 +0000 (11:41 +0200)
committerJosep Orga <jorga@somdevices.com>
Tue, 14 Apr 2020 09:41:52 +0000 (11:41 +0200)
TODO: Try not to use it or verify all cases.

To solve the problem:

get_if_handler Invalid handle
wilc_wlan_handle_rx_buff: wilc_netdev in wilc is NULL
wilc_wlan_handle_rx_buff: Data corrupted 0, 0
wilc_handle_isr,>> UNKNOWN_INTERRUPT - 0x00000182
get_if_handler Invalid handle
wilc_wlan_handle_rx_buff: wilc_netdev in wilc is NULL
wilc_handle_isr,>> UNKNOWN_INTERRUPT - 0x00004fea
cfg_get Timed Out
wilc_sdio mmc0:0001:1 wlan0: ERR [wilc_send_config_pkt:1800] Get Timed out
wilc_sdio mmc0:0001:1 wlan0: ERR [wilc_get_statistics:1106] Failed to send scan parameters
Unable to handle kernel paging request at virtual address ffff8cc4
pgd = 80004000
[ffff8cc4] *pgd=8bf5e861, *pte=00000000, *ppte=00000000
Internal error: Oops: 37 [#1] PREEMPT SMP ARM
Modules linked in: evbug wilc_sdio
CPU: 0 PID: 203 Comm: K_TXQ_TASK Not tainted 4.9.88-04802-g84dfb5dab852-dirty #115
Hardware name: Freescale i.MX6 UltraLite (Device Tree)
task: 887f0b00 task.stack: 88904000
PC is at wilc_wlan_txq_remove_from_head+0x4c/0x10c [wilc_sdio]
LR is at preempt_count_add+0xd4/0x14c
pc : [<7f00ce08>] lr : [<8014e52c>] psr: a00e0093
sp : 88905d40 ip : 0acbd000 fp : 00000000
r10: 88905dd4 r9 : 88905dc2 r8 : 0000000b
r7 : 200e0013 r6 : 884ae4e4 r5 : ffff8cc0 r4 : 884ae420
r3 : 884ae630 r2 : ffff8cc0 r1 : 884aed74 r0 : 200e0013
Flags: NzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment none
Control: 10c53c7d Table: 88a7c06a DAC: 00000051
Process K_TXQ_TASK (pid: 203, stack limit = 0x88904210)
Stack: (0x88905d40 to 0x88906000)
5d40: 88905dc0 887b6d00 88980000 0000000b 88905e04 00000060 884ae500 7f00f11c
5d60: 00000400 00000000 00000000 887404c0 7f013fa0 884aeb64 00000001 7f0185d4
5d80: 7f018600 884ae420 88905da8 884ae4cc 88905f3c 00000001 7f01a414 88980000
5da0: f0f8aea7 0d010000 01010101 00000001 00000000 00000000 00000000 00000000
5dc0: 887f0b00 8bb38a78 000029aa 00000000 b243dcee 00000006 000029aa 00000000
5de0: 8bb38a40 80e7ba40 887f0b00 8bb38a40 00000000 80160774 00000000 8bb38a40
5e00: 00000418 00000000 8bb38a40 00000000 0000000a 00000000 80f02d00 00000001
5e20: 887f0b80 0000003d 8bb38a78 80e7ba40 8bb38a40 887f0b00 88905e8c 809f8e5c
5e40: 8bb38a40 8014e1e4 80f03244 887f0e40 ffffffff 00000000 80f00000 8014a6fc
5e60: 887f0b00 00000000 80f00000 8bb38a40 887f0b00 80f06600 882398c0 00000000
5e80: 8bb35440 400e0013 80e78440 80f03244 00000001 809f8a88 02400000 8bb35440
5ea0: 80e78440 80180c74 88905ef0 88905ef0 8bb35440 88905ef0 00000001 809f8e08
5ec0: 8bb35440 80180cdc 00000000 400e0013 88905ee4 88905ef0 8bb35440 80180e98
5ee0: fffff2c8 809f801c 7fffffff 400e0013 00000200 00000000 fffff2c8 80180eb8
5f00: 887f0b00 884ae420 ffffe000 7f01a40c 884acf88 ffffff97 884ae450 884ae448
5f20: 00000001 7f005560 88740000 7f015e94 884ae538 884ae548 888f5840 00000001
5f40: 884ae420 00000000 888f5840 88904000 884ae420 7f0054c4 00000000 00000000
5f60: 00000000 80149344 00000000 00000000 887f0b00 884ae420 00000000 00000000
5f80: 88905f80 88905f80 00000000 00000000 88905f90 88905f90 888f5840 8014923c
5fa0: 00000000 00000000 00000000 80107950 00000000 00000000 00000000 00000000
5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[<7f00ce08>] (wilc_wlan_txq_remove_from_head [wilc_sdio]) from [<7f00f11c>] (wilc_wlan_handle_txq+0xb64/0xd80 [wilc_sdio])
[<7f00f11c>] (wilc_wlan_handle_txq [wilc_sdio]) from [<7f005560>] (wilc_txq_task+0x9c/0x248 [wilc_sdio])
[<7f005560>] (wilc_txq_task [wilc_sdio]) from [<80149344>] (kthread+0x108/0x110)
[<80149344>] (kthread) from [<80107950>] (ret_from_fork+0x14/0x24)
Code: e0234893 e5935744 e3550000 0a000016 (e5952004)
---[ end trace 875555a42b5ff364 ]---
note: K_TXQ_TASK[203] exited with preempt_count 1

Signed-off-by: Josep Orga <jorga@somdevices.com>
drivers/net/wireless/mchp/wilc_wlan.c

index 0ec1ee2..ab12270 100644 (file)
@@ -57,14 +57,30 @@ wilc_wlan_txq_remove_from_head(struct wilc *wilc, u8 q_num)
        struct txq_entry_t *tqe = NULL;
        unsigned long flags;
 
+       if (wilc->txq_entries <= 0 || wilc->txq[q_num].count == 0) {
+               pr_err("%s: txq_entries is 0\n", __func__);
+               return tqe;
+       }
+       if (wilc == NULL)
+               pr_err("%s: wilc is NULL\n", __func__);
+       if (wilc->txq == NULL)
+               pr_err("%s: wilc->txq is NULL\n", __func__);
        spin_lock_irqsave(&wilc->txq_spinlock, flags);
 
        if (!list_empty(&wilc->txq[q_num].txq_head.list)) {
                tqe = list_first_entry(&wilc->txq[q_num].txq_head.list,
                                       struct txq_entry_t, list);
-               list_del(&tqe->list);
-               wilc->txq_entries -= 1;
-               wilc->txq[q_num].count--;
+               if (tqe) {
+                       if(list_empty(&tqe->list))
+                               pr_err("%s: &tqe->list is empty\n", __func__);
+                       else {
+                               list_del(&tqe->list);
+                               wilc->txq_entries -= 1;
+                               wilc->txq[q_num].count--;
+                       }
+               }
+               else
+                       pr_err("%s: tqe is NULL\n", __func__);
        }
        spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
        return tqe;
@@ -1257,8 +1273,6 @@ out:
        mutex_unlock(&wilc->txq_add_to_head_cs);
 
        *txq_count = wilc->txq_entries;
-       if (ret == 1)
-               cfg_packet_timeout = 0;
        return ret;
 }