public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Ben McKeegan <ben@netservers.co.uk>,
	"David S. Miller" <davem@davemloft.net>
Subject: [patch 04/22] ppp: fix lost fragments in ppp_mp_explode() (resubmit)
Date: Thu, 10 Sep 2009 17:22:50 -0700	[thread overview]
Message-ID: <20090911002409.524280560@mini.kroah.org> (raw)
In-Reply-To: <20090911002616.GA12087@kroah.com>

[-- Attachment #1: ppp-fix-lost-fragments-in-ppp_mp_explode.patch --]
[-- Type: text/plain, Size: 3233 bytes --]

2.6.30-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Ben McKeegan <ben@netservers.co.uk>

[ Upstream commit a53a8b56827cc429c6d9f861ad558beeb5f6103f ]

This patch fixes the corner cases where the sum of MTU of the free
channels (adjusted for fragmentation overheads) is less than the MTU
of PPP link.  There are at least 3 situations where this case might
arise:

- some of the channels are busy

- the multilink session is running in a degraded state (i.e. with less
than its full complement of active channels)

- by design, where multilink protocol is being used to artificially
increase the effective link MTU of a single link.

Without this patch, at most 1 fragment is ever sent per free channel
for a given PPP frame and any remaining part of the PPP frame that
does not fit into those fragments is silently discarded.

This patch restores the original behaviour which was broken by commit
9c705260feea6ae329bc6b6d5f6d2ef0227eda0a 'ppp:ppp_mp_explode()
redesign'.  Once all 'free' channels have been given a fragment, an
additional fragment is queued to each available channel in turn, as many
times as necessary, until the entire PPP frame has been consumed.

Signed-off-by: Ben McKeegan <ben@netservers.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/net/ppp_generic.c |   34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -1383,7 +1383,7 @@ static int ppp_mp_explode(struct ppp *pp
 
 	/* create a	fragment for each channel */
 	bits = B;
-	while (nfree > 0 &&	len	> 0) {
+	while (len	> 0) {
 		list = list->next;
 		if (list ==	&ppp->channels)	{
 			i =	0;
@@ -1430,29 +1430,31 @@ static int ppp_mp_explode(struct ppp *pp
 		*otherwise divide it according to the speed
 		*of the channel we are going to transmit on
 		*/
-		if (pch->speed == 0) {
-			flen = totlen/nfree	;
-			if (nbigger > 0) {
-				flen++;
-				nbigger--;
-			}
-		} else {
-			flen = (((totfree - nzero)*(totlen + hdrlen*totfree)) /
-				((totspeed*totfree)/pch->speed)) - hdrlen;
-			if (nbigger > 0) {
-				flen += ((totfree - nzero)*pch->speed)/totspeed;
-				nbigger -= ((totfree - nzero)*pch->speed)/
+		if (nfree > 0) {
+			if (pch->speed == 0) {
+				flen = totlen/nfree	;
+				if (nbigger > 0) {
+					flen++;
+					nbigger--;
+				}
+			} else {
+				flen = (((totfree - nzero)*(totlen + hdrlen*totfree)) /
+					((totspeed*totfree)/pch->speed)) - hdrlen;
+				if (nbigger > 0) {
+					flen += ((totfree - nzero)*pch->speed)/totspeed;
+					nbigger -= ((totfree - nzero)*pch->speed)/
 							totspeed;
+				}
 			}
+			nfree--;
 		}
-		nfree--;
 
 		/*
 		 *check	if we are on the last channel or
 		 *we exceded the lenght	of the data	to
 		 *fragment
 		 */
-		if ((nfree == 0) || (flen > len))
+		if ((nfree <= 0) || (flen > len))
 			flen = len;
 		/*
 		 *it is not worth to tx on slow channels:
@@ -1466,7 +1468,7 @@ static int ppp_mp_explode(struct ppp *pp
 			continue;
 		}
 
-		mtu	= pch->chan->mtu + 2 - hdrlen;
+		mtu	= pch->chan->mtu - hdrlen;
 		if (mtu	< 4)
 			mtu	= 4;
 		if (flen > mtu)



  parent reply	other threads:[~2009-09-11  0:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090911002246.666327880@mini.kroah.org>
2009-09-11  0:26 ` [patch 00/22] 2.6.30.7-stable review Greg KH
2009-09-11  0:22   ` [patch 01/22] dccp: missing destroy of percpu counter variable while unload module Greg KH
2009-09-11  0:22   ` [patch 02/22] E100: fix interaction with swiotlb on X86 Greg KH
2009-09-11  0:22   ` [patch 03/22] gre: Fix MTU calculation for bound GRE tunnels Greg KH
2009-09-11  0:22   ` Greg KH [this message]
2009-09-11  0:22   ` [patch 05/22] pppol2tp: calls unregister_pernet_gen_device() at unload time Greg KH
2009-09-11  0:22   ` [patch 06/22] net: net_assign_generic() fix Greg KH
2009-09-11  0:22   ` [patch 07/22] sparc64: Kill spurious NMI watchdog triggers by increasing limit to 30 seconds Greg KH
2009-09-11  0:22   ` [patch 08/22] sparc64: Validate linear D-TLB misses Greg KH
2009-09-11  0:22   ` [patch 09/22] sparc64: Fix bootup with mcount in some configs Greg KH
2009-09-11  0:22   ` [patch 10/22] sparc: sys32.S incorrect compat-layer splice() system call Greg KH
2009-09-11  0:22   ` [patch 11/22] JFFS2: add missing verify buffer allocation/deallocation Greg KH
2009-09-11  0:22   ` [patch 12/22] slub: Fix kmem_cache_destroy() with SLAB_DESTROY_BY_RCU Greg KH
2009-09-11  0:22   ` [patch 13/22] nilfs2: fix preempt count underflow in nilfs_btnode_prepare_change_key Greg KH
2009-09-11  0:23   ` [patch 14/22] PCI SR-IOV: correct broken resource alignment calculations Greg KH
2009-09-11  0:23   ` [patch 15/22] SCSI: sd: fix bug in SCSI async probing Greg KH
2009-09-11  0:23   ` [patch 16/22] sound: oxygen: handle cards with missing EEPROM Greg KH
2009-09-11  0:23   ` [patch 17/22] sound: oxygen: fix MCLK rate for 192 kHz playback Greg KH
2009-09-11  0:23   ` [patch 18/22] dm raid1: do not allow log_failure variable to unset after being set Greg KH
2009-09-11  0:23   ` [patch 19/22] dm snapshot: refactor zero_disk_area to use chunk_io Greg KH
2009-09-11  0:23   ` [patch 20/22] dm snapshot: fix header corruption race on invalidation Greg KH
2009-09-11  0:23   ` [patch 21/22] dm exception store: split set_chunk_size Greg KH
2009-09-11  0:23   ` [patch 22/22] dm snapshot: fix on disk chunk size validation Greg KH
2009-09-11  5:19   ` [patch 00/22] 2.6.30.7-stable review Dmitry Torokhov
2009-09-11 15:31     ` [stable] " 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=20090911002409.524280560@mini.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ben@netservers.co.uk \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.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