Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wil6210: prevent access to 11AD device if resume fails

In case wil6210 resume fails, wil6210 suspend function will try
to access the suspended device in the next kernel suspend.
To prevent that, add wil_status_suspended flag to indicate if the
device is already suspended and clear it only if the resume succeeds.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>

authored by

Maya Erez and committed by
Kalle Valo
3161addd 98a830a9

+15 -2
+14 -2
drivers/net/wireless/ath/wil6210/pm.c
··· 71 71 72 72 wil_dbg_pm(wil, "suspend: %s\n", is_runtime ? "runtime" : "system"); 73 73 74 + if (test_bit(wil_status_suspended, wil->status)) { 75 + wil_dbg_pm(wil, "trying to suspend while suspended\n"); 76 + return 0; 77 + } 78 + 74 79 /* if netif up, hardware is alive, shut it down */ 75 80 if (ndev->flags & IFF_UP) { 76 81 rc = wil_down(wil); ··· 91 86 92 87 if (wil->platform_ops.suspend) { 93 88 rc = wil->platform_ops.suspend(wil->platform_handle); 94 - if (rc) 89 + if (rc) { 95 90 wil_enable_irq(wil); 91 + goto out; 92 + } 96 93 } 94 + 95 + set_bit(wil_status_suspended, wil->status); 97 96 98 97 out: 99 98 wil_dbg_pm(wil, "suspend: %s => %d\n", ··· 126 117 127 118 /* if netif up, bring hardware up 128 119 * During open(), IFF_UP set after actual device method 129 - * invocation. This prevent recursive call to wil_up() 120 + * invocation. This prevent recursive call to wil_up(). 121 + * wil_status_suspended will be cleared in wil_reset 130 122 */ 131 123 if (ndev->flags & IFF_UP) 132 124 rc = wil_up(wil); 125 + else 126 + clear_bit(wil_status_suspended, wil->status); 133 127 134 128 out: 135 129 wil_dbg_pm(wil, "resume: %s => %d\n",
+1
drivers/net/wireless/ath/wil6210/wil6210.h
··· 412 412 wil_status_irqen, /* FIXME: interrupts enabled - for debug */ 413 413 wil_status_napi_en, /* NAPI enabled protected by wil->mutex */ 414 414 wil_status_resetting, /* reset in progress */ 415 + wil_status_suspended, /* suspend completed, device is suspended */ 415 416 wil_status_last /* keep last */ 416 417 }; 417 418