From patchwork Tue Oct 27 07:35:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz.Dziedzic@tieto.com X-Patchwork-Id: 7494341 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D1010BEEA4 for ; Tue, 27 Oct 2015 07:35:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D796F2083F for ; Tue, 27 Oct 2015 07:35:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0BE4F2068F for ; Tue, 27 Oct 2015 07:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752574AbbJ0Hfa (ORCPT ); Tue, 27 Oct 2015 03:35:30 -0400 Received: from mail-lb0-f178.google.com ([209.85.217.178]:32840 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbbJ0Hf2 (ORCPT ); Tue, 27 Oct 2015 03:35:28 -0400 Received: by lbbec13 with SMTP id ec13so54924066lbb.0 for ; Tue, 27 Oct 2015 00:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=9P40m4MxUP4pIepFfwod519C7Ohfh0PGs6/dcqLTe5g=; b=vkcgcJT0LRlKy/mRHcaQffJi9WDSLaOYm+3PTfH5YnTl0rvQ8W6h7BIKF2HMA1lrUq pZENoQDx/MXWZkqNv8V76KtxrIknyZATBcmIHytWamA8ZEVzYX9cT5lJCgylt7ZJMBgL 4UwORrv7URdj5NXj0f7isoDf7B+vIdtRFqKik= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9P40m4MxUP4pIepFfwod519C7Ohfh0PGs6/dcqLTe5g=; b=J8Lz9aMIZ7m67OYdgmhvQnPOLOxFd2IWetbAxPCDJIbLcz6CGyWf0F2l3unlaApLqU Mm6s3rCxegD7t5YGccsHheac7rbMnjMU9pNXm4k2UAW6Egp9C+aFt9j7667QrnqTwRW/ JYpZj/vbuK1D99ZER39x/59R1dc8NdmsM/W5/XeaNVwlk6G8bRmFUaXDrseTJSipAdyh EMxv0faTcrMJPWfZUMba5yG0WT7gesHj0tSXGwAY3ysAOpA2GHN+zDtKvDR48HEZaSyG YQOKB8p/HmxSmTlfmZ1m7B9/8jn+PNRHYIpHdOD/BZhWVqcuSxuQVZzikjxITBShuBce jiMg== X-Gm-Message-State: ALoCoQkMerF57QlHLMsCtM+MuGMN/TEUjabSztPpDa/oExjB3Vq3+6dzIxhxZ/A7iN15sKa5TCD4AZxJCsYYtd9Jc6CEWfAuOnMSTrlYQ9l4xX27Jteo69AYDkyh/jYs/Y5ZyI4/KjSFJbXzBacnuRLQPqssmBUKni3SC0bvGHH27P7yC3pjKPqdqpugpi23eYI5T9vi13LD X-Received: by 10.112.148.38 with SMTP id tp6mr19211059lbb.110.1445931327570; Tue, 27 Oct 2015 00:35:27 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by smtp.gmail.com with ESMTPSA id vz2sm6625583lbb.35.2015.10.27.00.35.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Oct 2015 00:35:26 -0700 (PDT) From: Janusz Dziedzic To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Janusz Dziedzic Subject: [PATCH 01/14] mac80211: fix divide by zero when NOA update Date: Tue, 27 Oct 2015 08:35:11 +0100 Message-Id: <1445931311-14091-1-git-send-email-janusz.dziedzic@tieto.com> X-Mailer: git-send-email 1.9.1 X-DomainID: tieto.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of one shot NOA the interval could be 0. This patch fix such dump: divide error: 0000 [#1] SMP CPU: 4 PID: 0 Comm: swapper/4 Tainted: G W 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: ffff88022452d400 ti: ffff880224564000 task.ti: ffff880224564000 RIP: 0010:[] [] ieee80211_extend_noa_desc+0x3a/0x80 [mac80211] RSP: 0018:ffff88022e303da8 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff880221649e98 RCX: 00000000ffffffff RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880221649e98 RBP: ffff88022e303da8 R08: ffff880221649e98 R09: 0000000000000000 R10: 0000000098ce2400 R11: 0000000000000000 R12: ffff880221649e98 R13: ffff880221649e98 R14: 0000000000000000 R15: ffff880221649e9c FS: 0000000000000000(0000) GS:ffff88022e300000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007feac4d4e1b8 CR3: 0000000001c10000 CR4: 00000000001406e0 Stack: ffff88022e303df0 ffffffffc08e891c 98ce24a3e24e1520 ffff88022e303e0c 0000000000000005 ffff880221649e98 ffff880221649ec8 0000000098ce24a3 000000007fffffff ffff88022e303e38 ffffffffc08e8a17 00000000c068d1bd 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) {