From patchwork Tue Jun 11 13:10:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zefir Kurtisi X-Patchwork-Id: 10986927 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 189231398 for ; Tue, 11 Jun 2019 13:19:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2EE028405 for ; Tue, 11 Jun 2019 13:19:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E724D28783; Tue, 11 Jun 2019 13:19:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5805828405 for ; Tue, 11 Jun 2019 13:19:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390442AbfFKNTG (ORCPT ); Tue, 11 Jun 2019 09:19:06 -0400 Received: from mail.neratec.com ([46.140.151.2]:58664 "EHLO mail.neratec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387578AbfFKNTG (ORCPT ); Tue, 11 Jun 2019 09:19:06 -0400 X-Greylist: delayed 530 seconds by postgrey-1.27 at vger.kernel.org; Tue, 11 Jun 2019 09:19:05 EDT Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.neratec.com (Postfix) with ESMTP id 675BFCE0389; Tue, 11 Jun 2019 15:10:14 +0200 (CEST) Received: from mail.neratec.com ([127.0.0.1]) by localhost (mail.neratec.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id cQEEc7J5YASq; Tue, 11 Jun 2019 15:10:14 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.neratec.com (Postfix) with ESMTP id 46436CE038F; Tue, 11 Jun 2019 15:10:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.neratec.com 46436CE038F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neratec.com; s=9F5C293A-195B-11E9-BBA5-B4F3B9D999CA; t=1560258614; bh=cR0VlKJmTQ98hSkbaKiEpGPhdOfGFhHJyWmYjhCNvSE=; h=From:To:Date:Message-Id; b=ws9zhLdvAnnp4m8cxjHvRddzSghVpn7V+QVlB7OUpDZFFvMZHgvMiHQk3E11QBJ7u Ctq9gWeicdmX2E5Uf0AKgwLr4EbbYfSztGqF++jZwbKYYY0oO8n7Xx87irEPjmIpzb TzozRtVj+tZf6I8iuSS0kK2LsypAn2l3J4XUqurDHClCDpPP7stAcUB7IjuUvyOYnH GaOyQSQX4AZSggcNH5fxTMKr4V+fstmQAtiVi/VxaY1VwLP4MxIDO/PGB6r3UFZRO/ YEA4c2pGT55lS17+6ea4yNErYrVJzbqYSgZXiR0eZY4ZbcnaeEDGA3gxXu6HkKKbEN T+sms8Ec/M7tQ== X-Virus-Scanned: amavisd-new at neratec.com Received: from mail.neratec.com ([127.0.0.1]) by localhost (mail.neratec.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id JVccTLw_57Vi; Tue, 11 Jun 2019 15:10:14 +0200 (CEST) Received: from zefir.lan.neratec.com (zefir.lan.neratec.com [172.29.101.12]) by mail.neratec.com (Postfix) with ESMTPSA id 2AE1ECE0389; Tue, 11 Jun 2019 15:10:14 +0200 (CEST) From: Zefir Kurtisi To: linux-wireless@vger.kernel.org Cc: kvalo@codeaurora.org, nbd@nbd.name Subject: [PATCH] ath9k: corrctly handle short radar pulses (fixes 3c0efb745a) Date: Tue, 11 Jun 2019 15:10:06 +0200 Message-Id: <20190611131006.29715-1-zefir.kurtisi@neratec.com> X-Mailer: git-send-email 2.17.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In commit '3c0efb745a17 ("ath9k: discard undersized packets")' the lower bound of RX packets was set to 10 (min ACK size) to filter those that would otherwise be treated as invalid at mac80211. Alas, short radar pulses are reported as PHY_ERROR frames with length set to 3. Therefore their detection stopped working after that commit. NOTE: ath9k drivers built thereafter will not pass DFS certification. This extends the criteria for short packages to explicitly handle PHY_ERROR frames. Signed-off-by: Zefir Kurtisi --- drivers/net/wireless/ath/ath9k/recv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 4e97f7f3b2a3..5519c144d1f1 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c @@ -815,6 +815,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, struct ath_common *common = ath9k_hw_common(ah); struct ieee80211_hdr *hdr; bool discard_current = sc->rx.discard_next; + bool is_phyerr; /* * Discard corrupt descriptors which are marked in @@ -827,8 +828,11 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, /* * Discard zero-length packets and packets smaller than an ACK + * which are not PHY_ERROR (short radar pulses have a length of 3) */ - if (rx_stats->rs_datalen < 10) { + is_phyerr = rx_stats->rs_status & ATH9K_RXERR_PHY; + if (!rx_stats->rs_datalen || + (rx_stats->rs_datalen < 10 && !is_phyerr)) { RX_STAT_INC(sc, rx_len_err); goto corrupt; }