Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Plamen Petrov <pvp-lsts@fs.uni-ruse.bg>
Cc: Jarek Poplawski <jarkao2@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	netdev@vger.kernel.org, bugzilla-daemon@bugzilla.kernel.org,
	bugme-daemon@bugzilla.kernel.org
Subject: Re: [Bugme-new] [Bug 16626] New: Machine hangs with EIP at skb_copy_and_csum_dev
Date: Tue, 24 Aug 2010 17:08:52 +0200	[thread overview]
Message-ID: <1282662532.2477.248.camel@edumazet-laptop> (raw)
In-Reply-To: <4C73C8DF.4060601@fs.uni-ruse.bg>

Le mardi 24 août 2010 à 16:27 +0300, Plamen Petrov a écrit :

> The current status: if I enable GRO on the tg3 - the kernel oopses.
> It just takes a different amount of time to trigger: somewhere from
> 30 seconds to 30 minutes.
> 
> The oopses looks the same, and here are the latest:
> 
> [picture 13]
> http://picpaste.com/c8dbda8f5c15d9ce3e050dd7f245f5d0.jpg
> 
> [picture 14]
> http://picpaste.com/646cca586b704c5b72d3cf9fa54c7344.jpg
> 
> I was wondering which debug options could help us track this down?
> 

Thanks, here is an updated patch (against linux-2.6)

diff --git a/net/core/dev.c b/net/core/dev.c
index 3721fbb..77c8eb7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1935,6 +1935,32 @@ static inline int skb_needs_linearize(struct sk_buff *skb,
 					      illegal_highdma(dev, skb))));
 }
 
+int skb_csum_start_bug(const struct sk_buff *skb, int pos)
+{
+
+	if (skb->ip_summed == CHECKSUM_PARTIAL) {
+		long csstart;
+
+		csstart = skb->csum_start - skb_headroom(skb);
+		if (WARN_ON(csstart > skb_headlen(skb))) {
+			int i;
+
+			pr_err("%d: csum_start %u, offset %u, headroom %d, headlen %d, len %d\n",
+				   pos, skb->csum_start, skb->csum_offset, skb_headroom(skb),
+				   skb_headlen(skb), skb->len);
+			pr_err("nr_frags=%u gso_size=%u ",
+					skb_shinfo(skb)->nr_frags,
+					skb_shinfo(skb)->gso_size);
+			for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
+				pr_err("frag_size=%u ", skb_shinfo(skb)->frags[i].size);
+			}
+			pr_err("\n");
+			return 1;
+		}
+	}
+	return 0;
+}
+
 int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 			struct netdev_queue *txq)
 {
@@ -1959,11 +1985,15 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 				goto out_kfree_skb;
 			if (skb->next)
 				goto gso;
+			if (skb_csum_start_bug(skb, 10))
+				goto out_kfree_skb;
 		} else {
 			if (skb_needs_linearize(skb, dev) &&
 			    __skb_linearize(skb))
 				goto out_kfree_skb;
 
+			if (skb_csum_start_bug(skb, 20))
+				goto out_kfree_skb;
 			/* If packet is not checksummed and device does not
 			 * support checksumming for this protocol, complete
 			 * checksumming here.
@@ -1974,10 +2004,16 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 				if (!dev_can_checksum(dev, skb) &&
 				     skb_checksum_help(skb))
 					goto out_kfree_skb;
+				if (skb_csum_start_bug(skb, 30))
+					goto out_kfree_skb;
 			}
 		}
 
-		rc = ops->ndo_start_xmit(skb, dev);
+		if (skb_csum_start_bug(skb, 40)) {
+			kfree_skb(skb);
+			rc = NETDEV_TX_OK;
+		} else
+			rc = ops->ndo_start_xmit(skb, dev);
 		if (rc == NETDEV_TX_OK)
 			txq_trans_update(txq);
 		return rc;
@@ -1997,7 +2033,12 @@ gso:
 		if (dev->priv_flags & IFF_XMIT_DST_RELEASE)
 			skb_dst_drop(nskb);
 
-		rc = ops->ndo_start_xmit(nskb, dev);
+		if (skb_csum_start_bug(skb, 50)) {
+			kfree_skb(skb);
+			rc = NETDEV_TX_OK;
+		} else
+			rc = ops->ndo_start_xmit(nskb, dev);
+
 		if (unlikely(rc != NETDEV_TX_OK)) {
 			if (rc & ~NETDEV_TX_MASK)
 				goto out_kfree_gso_skb;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 3a2513f..3d54a1b 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1824,13 +1824,15 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
 {
 	__wsum csum;
 	long csstart;
+	extern int skb_csum_start_bug(const struct sk_buff *skb, int pos);
 
 	if (skb->ip_summed == CHECKSUM_PARTIAL)
 		csstart = skb->csum_start - skb_headroom(skb);
 	else
 		csstart = skb_headlen(skb);
 
-	BUG_ON(csstart > skb_headlen(skb));
+	if (skb_csum_start_bug(skb, 100))
+		return;
 
 	skb_copy_from_linear_data(skb, to, csstart);
 



  reply	other threads:[~2010-08-24 15:08 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-16626-10286@https.bugzilla.kernel.org/>
2010-08-19 22:21 ` [Bugme-new] [Bug 16626] New: Machine hangs with EIP at skb_copy_and_csum_dev Andrew Morton
2010-08-20  5:03   ` Plamen Petrov
2010-08-20  5:11     ` Andrew Morton
2010-08-20  6:12       ` Plamen Petrov
2010-08-20  6:20         ` Andrew Morton
2010-08-20  6:26           ` Plamen Petrov
2010-08-20  6:34             ` Eric Dumazet
2010-08-20  6:57               ` Plamen Petrov
2010-08-20  7:38               ` Plamen Petrov
2010-08-20  8:31               ` Plamen Petrov
2010-08-20  9:19                 ` Plamen Petrov
2010-08-20 10:26                   ` Eric Dumazet
2010-08-20 10:53                     ` Plamen Petrov
2010-08-20 19:38                       ` Jarek Poplawski
2010-08-21  7:47                         ` Jarek Poplawski
2010-08-21  7:50                           ` Eric Dumazet
2010-08-21  8:07                             ` Jarek Poplawski
2010-08-23 11:47                               ` Plamen Petrov
2010-08-23 12:35                                 ` Eric Dumazet
2010-08-23 12:47                                 ` Jarek Poplawski
2010-08-23 13:00                                   ` Eric Dumazet
2010-08-23 13:10                                     ` Jarek Poplawski
2010-08-23 13:43                                       ` Plamen Petrov
2010-08-23 14:05                                         ` Plamen Petrov
2010-08-23 14:14                                           ` Jarek Poplawski
2010-08-24  4:51                                             ` Plamen Petrov
2010-08-24  5:01                                               ` Eric Dumazet
2010-08-24  8:43                                                 ` Plamen Petrov
2010-08-24 13:27                                                   ` Plamen Petrov
2010-08-24 15:08                                                     ` Eric Dumazet [this message]
2010-08-24 17:25                                                       ` Plamen Petrov
2010-08-24 18:22                                                         ` Jarek Poplawski
2010-08-24 19:19                                                         ` Eric Dumazet
2010-08-25  7:05                                                           ` Plamen Petrov
2010-08-29  7:48                                                             ` [PATCH] net: reset ip_summed in skb_tunnel_rx() Eric Dumazet
2010-08-29 15:35                                                               ` Jesse Gross
2010-08-27  8:44                                                       ` [Bugme-new] [Bug 16626] New: Machine hangs with EIP at skb_copy_and_csum_dev Plamen Petrov
2010-08-24  5:19                                               ` Plamen Petrov
2010-08-24  6:18                                                 ` Jarek Poplawski

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=1282662532.2477.248.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bugme-daemon@bugzilla.kernel.org \
    --cc=bugzilla-daemon@bugzilla.kernel.org \
    --cc=jarkao2@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pvp-lsts@fs.uni-ruse.bg \
    /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