ppp, slip: Validate VJ compression slot parameters completely
authorBen Hutchings <ben@decadent.org.uk>
Sun, 1 Nov 2015 16:22:53 +0000 (16:22 +0000)
committerWilly Tarreau <w@1wt.eu>
Fri, 29 Jan 2016 21:12:38 +0000 (22:12 +0100)
commit42fc512469e78939c1e419d3310c47de55bdcbb8
treecac57a3e51bd80907be14103317b5c5d57ae7eff
parent1debe900d2802b56dfa14f89e2918453539d85c6
ppp, slip: Validate VJ compression slot parameters completely

commit 4ab42d78e37a294ac7bc56901d563c642e03c4ae upstream.

Currently slhc_init() treats out-of-range values of rslots and tslots
as equivalent to 0, except that if tslots is too large it will
dereference a null pointer (CVE-2015-7799).

Add a range-check at the top of the function and make it return an
ERR_PTR() on error instead of NULL.  Change the callers accordingly.

Compile-tested only.

Reported-by: é\83­æ°¸å\88\9a <guoyonggang@360.cn>
References: http://article.gmane.org/gmane.comp.security.oss.general/17908
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 2.6.32: adjust filenames, context, indentation]
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/isdn/i4l/isdn_ppp.c
drivers/net/ppp_generic.c
drivers/net/slhc.c
drivers/net/slip.c