Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933546AbbLBRmh (ORCPT ); Wed, 2 Dec 2015 12:42:37 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:43602 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933183AbbLBRBS (ORCPT ); Wed, 2 Dec 2015 12:01:18 -0500 From: Kamal Mostafa To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Cc: Janusz Dziedzic , Johannes Berg , Kamal Mostafa Subject: [PATCH 3.19.y-ckt 077/164] mac80211: fix divide by zero when NOA update Date: Wed, 2 Dec 2015 08:58:48 -0800 Message-Id: <1449075615-20754-78-git-send-email-kamal@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449075615-20754-1-git-send-email-kamal@canonical.com> References: <1449075615-20754-1-git-send-email-kamal@canonical.com> X-Extended-Stable: 3.19 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1796 Lines: 57 3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know. ------------------ From: "Janusz.Dziedzic@tieto.com" commit 519ee6918b91abdc4bc9720deae17599a109eb40 upstream. In case of one shot NOA the interval can be 0, catch that instead of potentially (depending on the driver) crashing like this: divide error: 0000 [#1] SMP [...] 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 [...] Signed-off-by: Janusz Dziedzic Signed-off-by: Johannes Berg Signed-off-by: Kamal Mostafa --- net/mac80211/util.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 1ce38e7..c5e76cf 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2891,6 +2891,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-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/