lkml.org 
[lkml]   [2013]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] net: mac80211: tx.c: be sure of 'sdata->vif.type' must be NL80211_IFTYPE_AP when be in NL80211_IFTYPE_AP case
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 --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);


-------------------------diff end--------------------------------

Thanks.
--
Chen Gang


\
 
 \ /
  Last update: 2013-11-30 13:21    [W:0.361 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site