From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAA88C43219 for ; Tue, 30 Apr 2019 12:05:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BAFE320835 for ; Tue, 30 Apr 2019 12:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556625924; bh=M2A9iqhs/KVUvfAoeL7RgXhLq80Db758QtOaHvcXZro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=POBw0Fpl+as7xtl9Rqhtj48j8riEvjUglecOxFBpHcoRXmq0947S0oHX1F/C+c3RE Z+q6xI5WPU8Kna9+Qtnh6bJ2my4D+YHPRIKkwj5Vg8p7a7rPTWLwsEB5c7lWAipv4G Lvaeoi29bCJmi/Yd56pppeOLa3ROuzVLVt7bkFEg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727164AbfD3MFS (ORCPT ); Tue, 30 Apr 2019 08:05:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:50842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729221AbfD3LmL (ORCPT ); Tue, 30 Apr 2019 07:42:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9170921734; Tue, 30 Apr 2019 11:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556624531; bh=M2A9iqhs/KVUvfAoeL7RgXhLq80Db758QtOaHvcXZro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sh0hC6vDJ3rIMvkCZ1IFLzd+hzD4mA6BgmbC4IhcEz0JUGo3hqkBlYm9oKbf7mThX 5m72smb937lNGXFuR2QQfKDD2RHZHoNjqBloE3WcT4rGGsRjJDhHWW0UpTOerS+g5o b9t4i30ZEMZxxLshAbgBXjpx8qI6N/nzzJ0FsBAE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+45474c076a4927533d2e@syzkaller.appspotmail.com, Ben Hutchings , David Miller , Linus Torvalds Subject: [PATCH 4.14 28/53] slip: make slhc_free() silently accept an error pointer Date: Tue, 30 Apr 2019 13:38:35 +0200 Message-Id: <20190430113556.164100265@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113549.400132183@linuxfoundation.org> References: <20190430113549.400132183@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Torvalds 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 Cc: David Miller Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- drivers/net/slip/slhc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 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 )