netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Lord <mlord@pobox.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
	Ming Lei <ming.lei@canonical.com>,
	davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: net/usb/ax88179_178a driver broken in linux-3.12
Date: Sun, 17 Nov 2013 13:56:56 -0500	[thread overview]
Message-ID: <52891178.2080509@pobox.com> (raw)
In-Reply-To: <52890C7E.6000607@pobox.com>

[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]

On 13-11-17 01:35 PM, Mark Lord wrote:
> The USB3 network adapter locks up consistently for me here in 3.12,
> but was working without issues in 3.11.x
> 
> Source of the problem is this patch:
>    http://patchwork.ozlabs.org/patch/264021/
> 
> Reverting the patch fixes the adapter.

Okay, upon closer inspection, the bug appears to be a math error.
Here's a simpler (non-revert) patch to fix the bug that was introduced in 3.12.

(un-mangled copy attached; reproduced below for ease of viewing).

Don't exceed more than the 8 bytes of reserved ("needed_headroom") space
when calling pskb_expand_head.  This fixes a bug introduced in linux-3.12.0.

Signed-off-by: Mark Lord <mlord@pobox.com>


--- ax88179_178a.c.orig 2013-11-03 18:41:51.000000000 -0500
+++ linux/drivers/net/usb/ax88179_178a.c        2013-11-17 13:47:26.127971404 -0500
@@ -1183,10 +1183,10 @@
        if (((skb->len + 8) % frame_size) == 0)
                tx_hdr2 |= 0x80008000;  /* Enable padding */

-       headroom = skb_headroom(skb) - 8;
+       headroom = skb_headroom(skb);

-       if ((skb_header_cloned(skb) || headroom < 0) &&
-           pskb_expand_head(skb, headroom < 0 ? 8 : 0, 0, GFP_ATOMIC)) {
+       if ((skb_header_cloned(skb) || headroom < 8) &&
+           pskb_expand_head(skb, headroom < 8 ? 8 - headroom : 0, 0, GFP_ATOMIC)) {
                dev_kfree_skb_any(skb);
                return NULL;
        }

-- 
Mark Lord
Real-Time Remedies Inc.
mlord@pobox.com

[-- Attachment #2: 51_ax88179_178a_fix_3.12_lockups.patch --]
[-- Type: text/x-patch, Size: 811 bytes --]

Don't exceed more than the 8 bytes of reserved ("needed_headroom") space
when calling pskb_expand_head.  This fixes a bug introduced in linux-3.12.0.

Signed-off-by: Mark Lord <mlord@pobox.com>

--- ax88179_178a.c.orig	2013-11-03 18:41:51.000000000 -0500
+++ linux/drivers/net/usb/ax88179_178a.c	2013-11-17 13:47:26.127971404 -0500
@@ -1183,10 +1183,10 @@
 	if (((skb->len + 8) % frame_size) == 0)
 		tx_hdr2 |= 0x80008000;	/* Enable padding */
 
-	headroom = skb_headroom(skb) - 8;
+	headroom = skb_headroom(skb);
 
-	if ((skb_header_cloned(skb) || headroom < 0) &&
-	    pskb_expand_head(skb, headroom < 0 ? 8 : 0, 0, GFP_ATOMIC)) {
+	if ((skb_header_cloned(skb) || headroom < 8) &&
+	    pskb_expand_head(skb, headroom < 8 ? 8 - headroom : 0, 0, GFP_ATOMIC)) {
 		dev_kfree_skb_any(skb);
 		return NULL;
 	}

       reply	other threads:[~2013-11-17 19:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <52890C7E.6000607@pobox.com>
2013-11-17 18:56 ` Mark Lord [this message]
2013-11-17 19:04   ` net/usb/ax88179_178a driver broken in linux-3.12 Mark Lord
2013-11-18 10:12     ` David Laight
2013-11-18 13:32       ` David Laight
2013-11-18 22:52         ` Mark Lord
2013-11-19 10:04           ` David Laight
2013-11-19 13:44             ` Mark Lord
2013-11-19 13:56               ` David Laight
2013-11-19 14:02             ` Mark Lord
2013-11-19 14:15               ` Eric Dumazet
2013-11-19 14:24                 ` Mark Lord
2013-11-19 14:43                 ` David Laight
2013-11-19 16:10                   ` Eric Dumazet
2013-11-19 16:26                     ` David Laight
2013-11-19 21:13             ` David Miller
2013-11-20  9:54               ` David Laight
2013-11-20 16:54                 ` Sarah Sharp
2013-11-30  2:58                   ` Mark Lord
     [not found]                     ` <5299546B.2020800-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2013-12-02  9:30                       ` David Laight
2013-12-02 15:05                         ` Mark Lord
     [not found]                           ` <529CA1D2.2070806-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2013-12-02 19:08                             ` Sarah Sharp
2013-12-02 19:11                               ` Mark Lord
2013-12-02 19:18                               ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52891178.2080509@pobox.com \
    --to=mlord@pobox.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=ming.lei@canonical.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).