Re: [PATCH 01/14] mac80211: fix divide by zero when NOA update

2015-11-03 Thread Johannes Berg
On Tue, 2015-10-27 at 08:35 +0100, Janusz Dziedzic wrote:
> In case of one shot NOA the interval could be 0.
> 
Applied, thanks!

johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/14] mac80211: fix divide by zero when NOA update

2015-10-27 Thread Janusz Dziedzic
In case of one shot NOA the interval could be 0.
This patch fix such dump:

divide error:  [#1] SMP
CPU: 4 PID: 0 Comm: swapper/4 Tainted: GW  OE   
4.3.0-rc3master-2015-10-12-00-hz250-wl-ath+ #27
Hardware name: Dell Inc. Latitude E6430/0H3MT5, BIOS A13 09/02/2013
task: 88022452d400 ti: 880224564000 task.ti: 880224564000
RIP: 0010:[]  [] 
ieee80211_extend_noa_desc+0x3a/0x80 [mac80211]
RSP: 0018:88022e303da8  EFLAGS: 00010246
RAX:  RBX: 880221649e98 RCX: 
RDX:  RSI:  RDI: 880221649e98
RBP: 88022e303da8 R08: 880221649e98 R09: 
R10: 98ce2400 R11:  R12: 880221649e98
R13: 880221649e98 R14:  R15: 880221649e9c
FS:  () GS:88022e30() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7feac4d4e1b8 CR3: 01c1 CR4: 001406e0
Stack:
88022e303df0 c08e891c 98ce24a3e24e1520 88022e303e0c
0005 880221649e98 880221649ec8 98ce24a3
7fff 88022e303e38 c08e8a17 c068d1bd
Call Trace:

[] ieee80211_extend_absent_time+0x6c/0xb0 [mac80211]
[] ieee80211_update_p2p_noa+0xb7/0xe0 [mac80211]
[] ath9k_p2p_ps_timer+0x170/0x190 [ath9k]
[] ath_gen_timer_isr+0xc8/0xf0 [ath9k_hw]
[] ath9k_tasklet+0x296/0x2f0 [ath9k]
[] tasklet_action+0xe5/0xf0
[] __do_softirq+0xd7/0x2a0
[] irq_exit+0xd7/0xe0
[] do_IRQ+0x56/0xd0
[] common_interrupt+0x87/0x87

[] ? cpuidle_enter_state+0xb8/0x220
[] ? cpuidle_enter_state+0x94/0x220
[] cpuidle_enter+0x17/0x20
[] call_cpuidle+0x3b/0x70
[] ? cpuidle_select+0x13/0x20
[] cpu_startup_entry+0x26c/0x330
[] start_secondary+0x149/0x170
Code: e5 4c 8d 04 87 45 8b 50 0c 41 8b 48 10 44 01 d1 83 e9 01 29 f1 31 f6 85 
c9 7e 04 89 f0 5d c3 45 8b 58 14 31 d2 41 8d 43 ff 29 c8 <41> f7 f3 42 0f b6 54 
0f 06 80 fa ff 74 0e 0f b6 ca 39 c8 7d 1b
RIP  [] ieee80211_extend_noa_desc+0x3a/0x80 [mac80211]
RSP 
---[ end trace e9ffc912b1ac465a ]---
Kernel panic - not syncing: Fatal exception in interrupt

Signed-off-by: Janusz Dziedzic 
---
 net/mac80211/util.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 60c4dbf..96ec2d1 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2954,6 +2954,13 @@ ieee80211_extend_noa_desc(struct ieee80211_noa_data 
*data, u32 tsf, int i)
if (end > 0)
return false;
 
+   /* One shot NOA  */
+   if (data->count[i] == 1)
+   return false;
+
+   if (data->desc[i].interval == 0)
+   return false;
+
/* End time is in the past, check for repetitions */
skip = DIV_ROUND_UP(-end, data->desc[i].interval);
if (data->count[i] < 255) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html