diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2015-11-01 11:22:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-02 16:25:00 -0500 |
commit | 4ab42d78e37a294ac7bc56901d563c642e03c4ae (patch) | |
tree | eed185aafd345a302f05711c3e6d5d80fca7c3f9 /drivers/isdn | |
parent | 0baa57d8dc32db78369d8b5176ef56c5e2e18ab3 (diff) |
ppp, slip: Validate VJ compression slot parameters completely
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: 郭永刚 <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>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/i4l/isdn_ppp.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 86f9abebcb72..9c1e8adaf4fc 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
@@ -322,9 +322,9 @@ isdn_ppp_open(int min, struct file *file) | |||
322 | * VJ header compression init | 322 | * VJ header compression init |
323 | */ | 323 | */ |
324 | is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */ | 324 | is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */ |
325 | if (!is->slcomp) { | 325 | if (IS_ERR(is->slcomp)) { |
326 | isdn_ppp_ccp_reset_free(is); | 326 | isdn_ppp_ccp_reset_free(is); |
327 | return -ENOMEM; | 327 | return PTR_ERR(is->slcomp); |
328 | } | 328 | } |
329 | #endif | 329 | #endif |
330 | #ifdef CONFIG_IPPP_FILTER | 330 | #ifdef CONFIG_IPPP_FILTER |
@@ -573,10 +573,8 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg) | |||
573 | is->maxcid = val; | 573 | is->maxcid = val; |
574 | #ifdef CONFIG_ISDN_PPP_VJ | 574 | #ifdef CONFIG_ISDN_PPP_VJ |
575 | sltmp = slhc_init(16, val); | 575 | sltmp = slhc_init(16, val); |
576 | if (!sltmp) { | 576 | if (IS_ERR(sltmp)) |
577 | printk(KERN_ERR "ippp, can't realloc slhc struct\n"); | 577 | return PTR_ERR(sltmp); |
578 | return -ENOMEM; | ||
579 | } | ||
580 | if (is->slcomp) | 578 | if (is->slcomp) |
581 | slhc_free(is->slcomp); | 579 | slhc_free(is->slcomp); |
582 | is->slcomp = sltmp; | 580 | is->slcomp = sltmp; |