netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: holger@eitzenberger.org
To: Oliver Neukum <oliver@neukum.org>
Cc: netdev@vger.kernel.org
Subject: [patch 1/1] asix: fix BUG in receive path when lowering MTU
Date: Fri, 03 May 2013 12:02:20 +0200	[thread overview]
Message-ID: <20130503113254.213946017@eitzenberger.org> (raw)
In-Reply-To: 20130503112618.108645718@eitzenberger.org

[-- Attachment #1: asix-fix-BUG-in-receive-path.diff --]
[-- Type: text/plain, Size: 1573 bytes --]

There is bug in the receive path of the asix driver at the time a
packet is received larger than MTU size and DF bit set:

 BUG: unable to handle kernel paging request at 0000004000000001
 IP: [<ffffffff8126f65b>] skb_release_head_state+0x2d/0xd2
 ...
 Call Trace:
  <IRQ> 
  [<ffffffff8126f86d>] ? skb_release_all+0x9/0x1e
  [<ffffffff8126f8ad>] ? __kfree_skb+0x9/0x6f
  [<ffffffffa00b4200>] ? asix_rx_fixup_internal+0xff/0x1ae [asix]
  [<ffffffffa00fb3dc>] ? usbnet_bh+0x4f/0x226 [usbnet]
  ...

It is easily reproducable by setting an MTU of 512 e. g. and sending
something like

  ping -s 1472 -c 1 -M do $SELF

from another box.

And this is because the rx->ax_skb is freed on error, but rx->ax_skb
is not reset, and the size is not reset to zero in this case.

And since the skb is added again to the usbnet->done skb queue it is
accessing already freed memory, resulting in the BUG when freeing a
2nd time.  I therefore think the value 0x0000004000000001 show in the
trace is more or less random data.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Index: linux-stable-3.8.y/drivers/net/usb/asix_common.c
===================================================================
--- linux-stable-3.8.y.orig/drivers/net/usb/asix_common.c	2013-05-02 11:28:32.000000000 +0200
+++ linux-stable-3.8.y/drivers/net/usb/asix_common.c	2013-05-03 11:33:00.000000000 +0200
@@ -100,6 +100,9 @@
 			netdev_err(dev->net, "asix_rx_fixup() Bad RX Length %d\n",
 				   rx->size);
 			kfree_skb(rx->ax_skb);
+			rx->ax_skb = NULL;
+			rx->size = 0U;
+
 			return 0;
 		}
 

  reply	other threads:[~2013-05-03 11:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03 10:02 [patch 0/1] [BUG PATCH] asix: fix BUG in receive path when lowering MTU holger
2013-05-03 10:02 ` holger [this message]
2013-05-03 20:12   ` [patch 1/1] " David Miller

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=20130503113254.213946017@eitzenberger.org \
    --to=holger@eitzenberger.org \
    --cc=netdev@vger.kernel.org \
    --cc=oliver@neukum.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).