From patchwork Wed Nov 27 04:53:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 3246421 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E76289F3B8 for ; Wed, 27 Nov 2013 04:52:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 067EF20567 for ; Wed, 27 Nov 2013 04:52:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 331CD20569 for ; Wed, 27 Nov 2013 04:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752397Ab3K0Evi (ORCPT ); Tue, 26 Nov 2013 23:51:38 -0500 Received: from mail-pd0-f181.google.com ([209.85.192.181]:52678 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750901Ab3K0Evg (ORCPT ); Tue, 26 Nov 2013 23:51:36 -0500 Received: by mail-pd0-f181.google.com with SMTP id p10so9057970pdj.40 for ; Tue, 26 Nov 2013 20:51:36 -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=ZY/0a0pDqD760ey+j0Q5HbtWra0bHHr3j0/gd7LG8i0=; b=jF+fGNqbGR43LKiqG185EoyduwZJrX/C13c0CV0Z3rETni1LdnTh1qNKFH4YV4JlGg GggwXG5TRP2KuRhuAa3W4hF9Ns+kkdxj6Fdadd6x9K60pmPLQKHYwW4dzkCWIxVX7MVs hB3lgZzHw5qeZ9BfBk1xxkh4zLx+ccAYmrAnb2Nk/S3mKTqJi69k1dow6LP27H8kH9Mb OJJNVC8dFsakaiC/HK601MRUOT5RUOJ1EBgpiSLLyI3TChiotS5EtlnTs/oxnoiphGRK tLwwNJOsVD2n5O87yDTLwMkLKPAcjk6cbnh5YN+q+/jjv3igLJI2oYBPLbHkPoubUmia lNyA== X-Received: by 10.68.178.68 with SMTP id cw4mr3108898pbc.15.1385527896374; Tue, 26 Nov 2013 20:51:36 -0800 (PST) Received: from [10.1.100.224] ([61.148.203.198]) by mx.google.com with ESMTPSA id uf2sm84650951pbc.28.2013.11.26.20.51.33 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 26 Nov 2013 20:51:36 -0800 (PST) Message-ID: <52957ADA.2080704@gmail.com> Date: Wed, 27 Nov 2013 12:53:46 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: "John W. Linville" CC: rkuo , "linux-kernel@vger.kernel.org" , David Miller , linux-wireless@vger.kernel.org, netdev Subject: [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> In-Reply-To: <5294255E.7040105@gmail.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_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 In next-20131122 tree, if "sdata->vif.type != NL80211_IFTYPE_AP", 'chanctx_conf' will be not initialized, so need check it. Related warning (with allmodconfig under hexagon): CC [M] net/mac80211/tx.o net/mac80211/tx.c: In function 'ieee80211_subif_start_xmit': net/mac80211/tx.c:1827:27: warning: 'chanctx_conf' may be used uninitialized in this function [-Wuninitialized] Signed-off-by: Chen Gang --- net/mac80211/tx.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index c558b24..f3245d6 100644 --- a/net/mac80211/tx.c +++ 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); if (!chanctx_conf) goto fail_rcu; fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS);