From patchwork Mon May 25 16:15:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bob Copeland X-Patchwork-Id: 6476341 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 971F2C0020 for ; Mon, 25 May 2015 16:16:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF1BA203AE for ; Mon, 25 May 2015 16:16:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC6BE203AD for ; Mon, 25 May 2015 16:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751012AbbEYQQF (ORCPT ); Mon, 25 May 2015 12:16:05 -0400 Received: from mail-ie0-f177.google.com ([209.85.223.177]:34254 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750781AbbEYQQC (ORCPT ); Mon, 25 May 2015 12:16:02 -0400 Received: by ieczm2 with SMTP id zm2so75256971iec.1 for ; Mon, 25 May 2015 09:16:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=Q0adGG+yL91q6I8cQJ1qKdFlvNCb6SYaJTygbJScDvo=; b=iXokdu2HLhjouziMyr+zkLD+I+qfLGGj/kOE/OzC6N+6soldhS5LuhLpWHNacW43U+ 6TOTIoEdATCvonOEtVSVkc86yopj0myz/ZSngEIsX/+pujS/azW8G8pXSULMCnwK7oLw vFNHFB+qesUqYq3uL8ZY7ZbIa24wdsztMVtlQaXJQaxwD5P06qXEOvPjWuWxqqp5Twzd SMVGhubnUHsmJQwyz4Yd/2maeij+6ucsWPGvuJkmJOKyK+zOTN8PI/coQAJ67PUbJxyr HRiHqp8xGCU4cQ/KlfcKjQpNp8uqEMe0YFzujkjpsz+NNfV3UYsZYOC1e8kgFz16dhqp hk6w== X-Gm-Message-State: ALoCoQm8dtYKauLskjqEKj8AAER/SLaCSEme0SOfRLfVXPp6xvT9TK6QOkkNybubBbkFW+EnV+Yb X-Received: by 10.43.171.70 with SMTP id nt6mr24509527icc.73.1432570562158; Mon, 25 May 2015 09:16:02 -0700 (PDT) Received: from hash ([2001:470:1d:6db:230:48ff:fe9d:9c89]) by mx.google.com with ESMTPSA id g32sm5273288ioj.20.2015.05.25.09.16.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 May 2015 09:16:00 -0700 (PDT) Received: from bob by hash with local (Exim 4.84) (envelope-from ) id 1Ywv2U-00056m-S0; Mon, 25 May 2015 12:15:42 -0400 Date: Mon, 25 May 2015 12:15:42 -0400 From: Bob Copeland To: Alexis Green Cc: Johannes Berg , linux-wireless , Jesse Jones Subject: Re: [PATCH] mac80211: fix a NULL dereference in ath9k (and likely other drivers) when fixed mesh paths are used Message-ID: <20150525161542.GA14318@localhost> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 On Thu, May 21, 2015 at 06:05:13PM -0700, Alexis Green wrote: > This patch fixes a NULL dereference in ath9k (and likely other drivers) when > fixed mesh paths are used. The problem is that when a station comes up > sta_info_alloc allocates ath_node implicitly via hw->sta_data_size. When it > does that the ath_node is zeroed out. The ath_node isn’t actually initialized > until the station becomes associated and ath9k_sta_state is called. Good catch. I wonder if we should instead remove the mesh special case in ieee80211_tx_h_check_assoc() -- given that we require an assoc station in peering before we send data frames to that RA, and userspace should also be setting assoc flag after MPM completes, I can't think of a reason offhand why we'd need to bail out there. Does this also fix the problem for you? It passed the wpa_supplicant test cases at least (but we aren't fixing mpaths in any of those...) From 246febaa51d555fda437cc8064798db06c5f4d6e Mon Sep 17 00:00:00 2001 From: Bob Copeland Date: Mon, 25 May 2015 12:01:52 -0400 Subject: [PATCH] mac80211: enable assoc check for mesh interfaces We already set a station to be associated when peering completes, both in user space and in the kernel. Thus we should always have an associated sta before sending data frames to that station. Failure to do this can cause crashes in the lower-level driver due to transmitting unicast data frames before driver sta structures (e.g. ampdu state in ath9k) are initialized. This could have happened if fixing mpaths, which could then allow TX to stations with whom we haven't yet completed peering. Reported-by: Alexis Green Signed-off-by: Bob Copeland --- net/mac80211/tx.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 667111ee6a20..5787f15a3a12 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -301,9 +301,6 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) if (tx->sdata->vif.type == NL80211_IFTYPE_WDS) return TX_CONTINUE; - if (tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT) - return TX_CONTINUE; - if (tx->flags & IEEE80211_TX_PS_BUFFERED) return TX_CONTINUE;