Commit cb6c1ee3 authored by Ebru Akagunduz's avatar Ebru Akagunduz Committed by Greg Kroah-Hartman

staging: wlan-ng: Fix restricted __be16 degrades to integer

skb->protocol variable type is __be16 and in if condition
it is comparing with ETH_P_80211_RAW constant variable
which is not __be16 type. Using be16_to_cpu() function,
value of skb->protocol converted native processor format.
This bug was found by sparse.
Signed-off-by: default avatarEbru Akagunduz <ebru.akagunduz@gmail.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1002a240
...@@ -358,7 +358,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb, ...@@ -358,7 +358,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
* and return success . * and return success .
* TODO: we need a saner way to handle this * TODO: we need a saner way to handle this
*/ */
if (skb->protocol != ETH_P_80211_RAW) { if (be16_to_cpu(skb->protocol) != ETH_P_80211_RAW) {
netif_start_queue(wlandev->netdev); netif_start_queue(wlandev->netdev);
netdev_notice(netdev, "Tx attempt prior to association, frame dropped.\n"); netdev_notice(netdev, "Tx attempt prior to association, frame dropped.\n");
netdev->stats.tx_dropped++; netdev->stats.tx_dropped++;
...@@ -369,7 +369,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb, ...@@ -369,7 +369,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
} }
/* Check for raw transmits */ /* Check for raw transmits */
if (skb->protocol == ETH_P_80211_RAW) { if (be16_to_cpu(skb->protocol) == ETH_P_80211_RAW) {
if (!capable(CAP_NET_ADMIN)) { if (!capable(CAP_NET_ADMIN)) {
result = 1; result = 1;
goto failed; goto failed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment