From patchwork Thu Dec 2 17:44:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Schaa X-Patchwork-Id: 375361 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB2HiQgW026750 for ; Thu, 2 Dec 2010 17:44:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757295Ab0LBRoY (ORCPT ); Thu, 2 Dec 2010 12:44:24 -0500 Received: from mail-bw0-f46.google.com ([209.85.214.46]:56974 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752662Ab0LBRoX (ORCPT ); Thu, 2 Dec 2010 12:44:23 -0500 Received: by bwz15 with SMTP id 15so7481997bwz.19 for ; Thu, 02 Dec 2010 09:44:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=TjPrcKBnsSm2EzW6iPU3p0RSF+dCbydT1uVitiBAzNE=; b=Engd5aXBBt+yhyzNEiDpoE/P9rli1SV4OGIrA84gZV1+Xvjv1XIToufJQyEZ+emRJd b7R4acfW56yt41ZppPL2UR9XrEENoxpm6IvyEW1gOEC5zG/n5c2Xd31CjRkaLzGYL0XS +3UPvnbdcrIs7GTq0WBTon0A8dLNgGnimNXEA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=shkCPtoei6LvnJ7RydljhoqupexSBGdZ4CC8pHDMyW/XPTvcRCy/9++TiBUQiYbadq 9GAEcRV/1dNiPV+bskW8Jm/v72FfyALYQqIsQr/DjYLCvENilDtnJYhWJLB5OMhD6lRL 0gBNe94DiIy8dEU2DzQ35wVdSt5IZJ/D1AHp8= Received: by 10.204.53.142 with SMTP id m14mr1117053bkg.147.1291311861677; Thu, 02 Dec 2010 09:44:21 -0800 (PST) Received: from localhost.localdomain (p5495FD38.dip.t-dialin.net [84.149.253.56]) by mx.google.com with ESMTPS id g8sm422725bkg.23.2010.12.02.09.44.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 02 Dec 2010 09:44:20 -0800 (PST) From: Helmut Schaa To: "John W. Linville" Cc: linux-wireless@vger.kernel.org, Helmut Schaa , Johannes Berg Subject: [PATCH] mac80211: Fix BUG in pskb_expand_head when transmitting shared skbs Date: Thu, 2 Dec 2010 18:44:09 +0100 Message-Id: <1291311849-13086-1-git-send-email-helmut.schaa@googlemail.com> X-Mailer: git-send-email 1.7.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 02 Dec 2010 17:44:26 +0000 (UTC) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 41bfbbf..99fa95b 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1741,15 +1741,13 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, int nh_pos, h_pos; struct sta_info *sta = NULL; u32 sta_flags = 0; + struct sk_buff *tmp_skb; if (unlikely(skb->len < ETH_HLEN)) { ret = NETDEV_TX_OK; goto fail; } - nh_pos = skb_network_header(skb) - skb->data; - h_pos = skb_transport_header(skb) - skb->data; - /* convert Ethernet header to proper 802.11 header (based on * operation mode) */ ethertype = (skb->data[12] << 8) | skb->data[13]; @@ -1922,6 +1920,20 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, goto fail; } + /* + * If the skb is shared we need to obtain our own copy. + */ + if (skb_shared(skb)) { + tmp_skb = skb; + skb = skb_copy(skb, GFP_ATOMIC); + kfree_skb(tmp_skb); + + if (!skb) { + ret = NETDEV_TX_OK; + goto fail; + } + } + hdr.frame_control = fc; hdr.duration_id = 0; hdr.seq_ctrl = 0; @@ -1940,6 +1952,9 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, encaps_len = 0; } + nh_pos = skb_network_header(skb) - skb->data; + h_pos = skb_transport_header(skb) - skb->data; + skb_pull(skb, skip_header_bytes); nh_pos -= skip_header_bytes; h_pos -= skip_header_bytes;