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.0 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 95079C04E87 for ; Wed, 15 May 2019 12:21:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B4AE20578 for ; Wed, 15 May 2019 12:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557922907; bh=M2A9iqhs/KVUvfAoeL7RgXhLq80Db758QtOaHvcXZro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LzfmK61i4b6Zs86WotTm2iCUCvOtyxuCmpjpLArmC5tOZ4qLFSiWg/U9drDumJ08o jcI0+poC8zmY7itFid2+gf0aZjJ7K3MFfPc1qAsMRpAMpejTqEuUQ44B3lDSnWv2XZ 6yeG1LVqdpPvZ5hkNK7nYU0EQaS8ztxCieAxc6DU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726799AbfEOK6Y (ORCPT ); Wed, 15 May 2019 06:58:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:54616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726793AbfEOK6X (ORCPT ); Wed, 15 May 2019 06:58:23 -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 8C32C2084E; Wed, 15 May 2019 10:58:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557917903; bh=M2A9iqhs/KVUvfAoeL7RgXhLq80Db758QtOaHvcXZro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=depS9i4vB8FrTecKnwwrWpqoYMBTgzi93FMuDgeksU9alJZskIfw+r0WW5csZkTIM Dj3qBxzmXu5c4hKrW1Gy0hRd00lYUV/lD/mPyfRDPPFXxubJjAutZGhuLBSARJMu3U pkHe48i2JogcWhXBKyoRyt8wGnRf0vv6H08vvxg4= 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 3.18 06/86] slip: make slhc_free() silently accept an error pointer Date: Wed, 15 May 2019 12:54:43 +0200 Message-Id: <20190515090643.765376645@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090642.339346723@linuxfoundation.org> References: <20190515090642.339346723@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 )