Skip to contentSkip to conversation

ppp: deflate: never return len larger than output buffer

PATCH In review Florian Westphal 2 participants 2 messages Jan 29, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppp: deflate: never return len larger than output buffer

When we've run out of space in the output buffer to store more data, we will call zlib_deflate with a NULL output buffer until we've consumed remaining input.

When this happens, olen contains the size the output buffer would have consumed iff we'd have had enough room.

This can later cause skb_over_panic when ppp_generic skb_put()s the returned length.

---

drivers/net/ppp/ppp_deflate.c +1 -1
index 602c625..b5edc7f 100644
@@ -246,7 +246,7 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf,
 	/*
 	 * See if we managed to reduce the size of the packet.
 	 */
-	if (olen < isize) {
+	if (olen < isize && olen <= osize) {
 		state->stats.comp_bytes += olen;
 		state->stats.comp_packets++;
 	} else {
Signature · 1 line
2.0.5
maintainer
#1 lore raw

From: Florian Westphal <[email protected]>
Date: Wed, 28 Jan 2015 10:56:04 +0100

Quoted 4 lines

When we've run out of space in the output buffer to store more data, we will call zlib_deflate with a NULL output buffer until we've consumed remaining input.

Quoted 8 lines

When this happens, olen contains the size the output buffer would have consumed iff we'd have had enough room.

This can later cause skb_over_panic when ppp_generic skb_put()s the returned length.

Applied and queued up for -stable, thanks Florian.