summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-04-25 16:13:58 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-16 09:17:13 +0200
commit0cc8c5a2299626c72efdcb004d1c348d0e97121f (patch)
treee0a3ecb98b487fd05bb030f0ea8cec219bc67438 /drivers
parentb0b38ec243465c545874e7aec262fe5168aed049 (diff)
downloadlinux-stable-0cc8c5a2299626c72efdcb004d1c348d0e97121f.tar.gz
linux-stable-0cc8c5a2299626c72efdcb004d1c348d0e97121f.tar.bz2
linux-stable-0cc8c5a2299626c72efdcb004d1c348d0e97121f.zip
slip: make slhc_free() silently accept an error pointer
commit baf76f0c58aec435a3a864075b8f6d8ee5d1f17e upstream. This way, slhc_free() accepts what slhc_init() returns, whether that is an error or not. In particular, the pattern in sl_alloc_bufs() is slcomp = slhc_init(16, 16); ... slhc_free(slcomp); for the error handling path, and rather than complicate that code, just make it ok to always free what was returned by the init function. That's what the code used to do before commit 4ab42d78e37a ("ppp, slip: Validate VJ compression slot parameters completely") when slhc_init() just returned NULL for the error case, with no actual indication of the details of the error. Reported-by: syzbot+45474c076a4927533d2e@syzkaller.appspotmail.com Fixes: 4ab42d78e37a ("ppp, slip: Validate VJ compression slot parameters completely") Acked-by: Ben Hutchings <ben@decadent.org.uk> Cc: David Miller <davem@davemloft.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/slip/slhc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/slip/slhc.c b/drivers/net/slip/slhc.c
index cfd81eb1b532..ddceed3c5a4a 100644
--- a/drivers/net/slip/slhc.c
+++ b/drivers/net/slip/slhc.c
@@ -153,7 +153,7 @@ out_fail:
void
slhc_free(struct slcompress *comp)
{
- if ( comp == NULLSLCOMPR )
+ if ( IS_ERR_OR_NULL(comp) )
return;
if ( comp->tstate != NULLSLSTATE )