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=ham 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 B2D8FC43219 for ; Tue, 30 Apr 2019 11:47:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8357D21670 for ; Tue, 30 Apr 2019 11:47:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556624843; bh=M2A9iqhs/KVUvfAoeL7RgXhLq80Db758QtOaHvcXZro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mhJiqX6A7p7MvNC+2X1wiUyuzaZxlh3GE6nnVliBg3LWEbzLrN2OOEdvr3EbhsXi7 MKrk7c4hcIpz2cNAORGOnZgST2ldavTuf/B8uTap/SjFd0VSuYR1icUF0ZUumzzpRw MEwdzKMWjgnNaR7sj1SGO9pymZ6qGVE4uwGAvZkA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730694AbfD3LrW (ORCPT ); Tue, 30 Apr 2019 07:47:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:60644 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730678AbfD3LrO (ORCPT ); Tue, 30 Apr 2019 07:47:14 -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 2D3FF20449; Tue, 30 Apr 2019 11:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556624833; bh=M2A9iqhs/KVUvfAoeL7RgXhLq80Db758QtOaHvcXZro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zhgYwhV38+RTtnqYWVbovOpsswTOM8hAFNrplVAlhiq8egr+5zSZu4/jFWvdYl0oZ 4L/vvYMNP8ck7cNbXx7E6YGazhjW3ZAVueXckXTI/1Q4z5+6d6WDr8q9E6jUMWbt5z u1LRlDJ3KJr0fe4E4/lZmVlBQyBIRQcSasmW9MHc= 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.19 052/100] slip: make slhc_free() silently accept an error pointer Date: Tue, 30 Apr 2019 13:38:21 +0200 Message-Id: <20190430113611.444954713@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113608.616903219@linuxfoundation.org> References: <20190430113608.616903219@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 )