Netdev List
 help / color / mirror / Atom feed
From: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
To: davem@davemloft.net
Cc: yoshfuji@linux-ipv6.org, netdev@vger.kernel.org
Subject: [PATCH 2/4] [IPV6]: Fix oops during flushing corked datagrams.
Date: Thu, 13 Sep 2007 09:30:51 +0900 (JST)	[thread overview]
Message-ID: <20070913.093051.04296781.yoshfuji@linux-ipv6.org> (raw)

When we corking sub-datagrams, we do not clone skb->dst for sub-datagrams
other than the first one, so we get oops if we have multiple sub-datagrams
here.

One possible way to fix this is to clone skb->dst for all sub-datagrams,
but we do not take this approach because skb->dst is not used in other
places and it is more natural to increment statistics once per a datagram.

Also applicable for stable releases.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 4704b5f..6530044 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1423,8 +1423,15 @@ void ip6_flush_pending_frames(struct sock *sk)
 	struct sk_buff *skb;
 
 	while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
-		IP6_INC_STATS(ip6_dst_idev(skb->dst),
-			      IPSTATS_MIB_OUTDISCARDS);
+		if (skb->dst) {
+			/*
+			 * Note: we count standard stats once per "datagram"
+			 * and skb->dst is set only for the first 
+			 * sub-datagram of the datagram.
+			 */
+			IP6_INC_STATS(ip6_dst_idev(skb->dst),
+				      IPSTATS_MIB_OUTDISCARDS);
+		}
 		kfree_skb(skb);
 	}
 

-- 
YOSHIFUJI Hideaki @ USAGI Project  <yoshfuji@linux-ipv6.org>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

             reply	other threads:[~2007-09-13  0:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-13  0:30 YOSHIFUJI Hideaki / 吉藤英明 [this message]
2007-09-15  0:18 ` [PATCH 2/4] [IPV6]: Fix oops during flushing corked datagrams 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=20070913.093051.04296781.yoshfuji@linux-ipv6.org \
    --to=yoshfuji@linux-ipv6.org \
    --cc=davem@davemloft.net \
    --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