From patchwork Sat Nov 30 11:59:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 3260181 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3878CBEEAD for ; Sat, 30 Nov 2013 11:59:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 37DCA205F4 for ; Sat, 30 Nov 2013 11:59:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5702320256 for ; Sat, 30 Nov 2013 11:59:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751559Ab3K3L7A (ORCPT ); Sat, 30 Nov 2013 06:59:00 -0500 Received: from mail-pd0-f177.google.com ([209.85.192.177]:59949 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751214Ab3K3L67 (ORCPT ); Sat, 30 Nov 2013 06:58:59 -0500 Received: by mail-pd0-f177.google.com with SMTP id q10so15134618pdj.22 for ; Sat, 30 Nov 2013 03:58:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Ijvw/8Xm590RXV9kSTgdpP3154d5omC2++rjlGr00VI=; b=SBgeCUNpQfkkY4tRVIDfrekvWAZFfo05lXTHC7PDPbn0CAfdvCQK6ztVjXh3zLBmOl 6Voy0HmYqwdSxViXQXTuaNgwx6r3hvMaw49bk3liZKfddQcYMsvj3USxqqcyNLsPMKIq oSFAW2jyXrJR7VyFroDyKuoUM76xYDsnNuZBH0/3CycBE2ohxfnH9iVkMO6pqblQFLF4 E9sxMKLJu1vF8EmWwnDh5mkSix8KnkTyVEvqxMCb3QHbETQSKZTqJk72QQkH5/TwI2/1 CHD6wtJAPaMtGcA9glfkLvEedPr37NQ2gKf0zQFKQJbn2hM4DXFAYxUxFB/eHRVsFqGU mtjA== X-Received: by 10.69.31.97 with SMTP id kl1mr20655369pbd.127.1385812738730; Sat, 30 Nov 2013 03:58:58 -0800 (PST) Received: from [192.168.1.102] ([221.179.168.37]) by mx.google.com with ESMTPSA id lh13sm14520217pab.4.2013.11.30.03.58.56 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 30 Nov 2013 03:58:58 -0800 (PST) Message-ID: <5299D306.7070701@gmail.com> Date: Sat, 30 Nov 2013 19:59:02 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Johannes Berg CC: "John W. Linville" , rkuo , "linux-kernel@vger.kernel.org" , David Miller , linux-wireless@vger.kernel.org, netdev Subject: Re: [PATCH] net: mac80211: tx.c: be sure of 'sdata->vif.type' must be NL80211_IFTYPE_AP when be in NL80211_IFTYPE_AP case References: <528AEFB7.4060301@gmail.com> <20131125011938.GB18921@codeaurora.org> <5292B845.3010404@gmail.com> <5292B8A0.7020409@gmail.com> <5294255E.7040105@gmail.com> <52957ADA.2080704@gmail.com> (sfid-20131127_055211_558798_A7DF5684) <1385739487.8656.1.camel@jlt4.sipsolutions.net> In-Reply-To: <1385739487.8656.1.camel@jlt4.sipsolutions.net> 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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 On 11/29/2013 11:38 PM, Johannes Berg wrote: > >> +++ b/net/mac80211/tx.c >> @@ -1814,8 +1814,9 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, >> break; >> /* fall through */ >> case NL80211_IFTYPE_AP: >> - if (sdata->vif.type == NL80211_IFTYPE_AP) >> - chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); >> + if (sdata->vif.type != NL80211_IFTYPE_AP) >> + goto fail_rcu; >> + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); > > This change is completely wrong. > Oh, it is. Hmm... for me, this work flow still can be implemented with a little clearer way (at least it will avoid related warning): -------------------------diff begin------------------------------ -------------------------diff end-------------------------------- Thanks. diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index c558b24..7076128 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1810,14 +1810,14 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, if (!chanctx_conf) goto fail_rcu; band = chanctx_conf->def.chan->band; - if (sta) - break; - /* fall through */ + if (!sta) + goto try_next; + break; case NL80211_IFTYPE_AP: - if (sdata->vif.type == NL80211_IFTYPE_AP) - chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); if (!chanctx_conf) goto fail_rcu; +try_next: fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); /* DA BSSID SA */ memcpy(hdr.addr1, skb->data, ETH_ALEN);