From patchwork Tue May 9 18:16:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Skeffington X-Patchwork-Id: 9718813 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8ED1C60236 for ; Tue, 9 May 2017 18:16:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8592C28435 for ; Tue, 9 May 2017 18:16:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A3562843C; Tue, 9 May 2017 18:16:35 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 EAEAE28435 for ; Tue, 9 May 2017 18:16:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754120AbdEISQd (ORCPT ); Tue, 9 May 2017 14:16:33 -0400 Received: from mail-ua0-f174.google.com ([209.85.217.174]:33352 "EHLO mail-ua0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751947AbdEISQc (ORCPT ); Tue, 9 May 2017 14:16:32 -0400 Received: by mail-ua0-f174.google.com with SMTP id e28so9651367uah.0 for ; Tue, 09 May 2017 11:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=astro-ai.20150623.gappssmtp.com; s=20150623; h=mime-version:reply-to:from:date:message-id:subject:to:cc; bh=Ix+9wAon2x08vqOcTlGc9/iO8EP3YFYPB4ux563EtVY=; b=J2bq4foWP5xqAGeX1OMx5jksEufXeva4fWVbsliaPs0IvnQZXWL/naCFv8CRj8grWD MN+ni6sbNGBbcQN47X2vUBE+bOHOUsvEb/T1zReXPD2TK3rFPjjZ1DuIS2AZfgHlCNNY x+CSyd7uWAmhQ8FhAtE/icyCzt05JO3rZqPC9qSSf6+2X7qydNlOdhrDOUdZx1BNi/DA gWCC69qOAx6CkxKGB5vMtyLqjt0Ir7dpZIB3/hK9WI679222JWbOO0iQQckiZyRCIbXm 5RC/78QhRkNdRLxWjvH+p5MZIsg7alB797dNbQ1DkaeXeGwAXLImAx8IMOP8uw7coEFQ W88Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:from:date:message-id :subject:to:cc; bh=Ix+9wAon2x08vqOcTlGc9/iO8EP3YFYPB4ux563EtVY=; b=M/pFYNLjGNUdXZToql1fwqoToTM5CdlRhIzVzRjCGDPNmwnWs8f0VTdYP3x1TwMuzR NP6oVYvlLWEJJ22El8+6ueC3tIVpfDUG8P/vA9cNmcFQ2anLld1Wi9SGxk2f5mE44IjH Oi0XTCR1OO333JB+un/jsFQwwmhCevAwLy9clnPriwq10YezoilI48d3LHMtTOyTty6b uY5BtZS0rx/K6hstO195jpLYC9pGaqdeHXBL/gbjVwggLV+4vf7tTOrA9BMt9oqjHXy7 agMynPUPONIKxQRZRV9a6wGLEu+kaU2cHlptNTtvGEilzB2wbsG4zL2m9TG/Umo3L9hW cz7Q== X-Gm-Message-State: AODbwcD9bID6xvJS5ef1dfZ60SfF8o1AT5Xre06nLG8wc9aodGJva9iM /HtkCRpXg1U+HWOcWpjWw2NOxoD/3w+HX2g= X-Received: by 10.176.91.20 with SMTP id u20mr730854uae.138.1494353791455; Tue, 09 May 2017 11:16:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.16.6 with HTTP; Tue, 9 May 2017 11:16:31 -0700 (PDT) Reply-To: mike@hellotwist.com From: Michael Skeffington Date: Tue, 9 May 2017 14:16:31 -0400 Message-ID: Subject: [PATCH] mac80211: Validate michael MIC before attempting packet decode. To: Johannes Berg Cc: linux-wireless@vger.kernel.org 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 order to allow wpa_supplicant to correctly identify a perceived WPA TKIP key recovery attack the michael MIC must be checked before the packet decode is attempted. A packet with an invalid MIC will always fail a decrypt check which previously was being checked first. Therefore the MIC failure bit of status flags describing the error would remain unset. Signed-off-by: Michael Skeffington --- #ifdef CONFIG_MAC80211_MESH if (ieee80211_vif_is_mesh(&rx->sdata->vif)) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index bc08185..71f1a56 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -3176,9 +3176,10 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx, CALL_RXH(ieee80211_rx_h_check_more_data) CALL_RXH(ieee80211_rx_h_uapsd_and_pspoll) CALL_RXH(ieee80211_rx_h_sta_process) + /* must be before decrypt so MIC failures are reported to netlink */ + CALL_RXH(ieee80211_rx_h_michael_mic_verify) CALL_RXH(ieee80211_rx_h_decrypt) CALL_RXH(ieee80211_rx_h_defragment) - CALL_RXH(ieee80211_rx_h_michael_mic_verify) /* must be after MMIC verify so header is counted in MPDU mic */