Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4810994yba; Tue, 30 Apr 2019 04:54:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwG/AQ7JtlgqO8+iBVA2AlRfH/6sas4/XMUPvfQg46qD2FiT9m9yboNlEX3PSNu+dDoWMsP X-Received: by 2002:a62:e90d:: with SMTP id j13mr29454392pfh.42.1556625270539; Tue, 30 Apr 2019 04:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556625270; cv=none; d=google.com; s=arc-20160816; b=qJesgf2+mT44coQ7QiNzYGpr7oh2NTWspfYzzrQihJz5vFr0rsrMorXm2grhHW9giB G5dR6wEAPi+1Y0x+7Ut0kVztbEEWbFQKQo3axEOXVuAj7eA4TG1PwiJCrphwB93F5BLu 2jKrJXolmQ1quJ+NfnB8uVdhommm/MFsA6u71a+kaf72JsWHqbytngNFmaFE0sZKmbXF v1A4VmNdJhG4owchfkZqQy506YODYrHWeysuwYE9vgdc++6iLT68CFRQX+Mfz/7mqp4g 4rADmvrLLMKuAqa35fIDqRugf7rs4MImKeSu/nwGO1RmJ3+Zjcx0RCqHxULWpgaJAc+v r2Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MrTZfmFh62DOaOuKTMt98mInjFJ2+TjVP1wik18LaGU=; b=hHLd32QYPQUaYbExkya9Zv2M2AMSEVVAXtYcnuFq3v07+QAneTOljzb76dcGwOQ8pj 8qwlrNSJAUFUpZF6W582gdxjTlq0AsANHf7l4xdzrdnRcLY52YjVfx8/8bkERquOX6l4 oMc19H3EIcc6cU7Ob1qVEzMVt/MmxfGe/E4W4PV7OxtcVNnKAWWL3N+e+hOH05HhGrgN 0p/iG7LjQoIH+aO0ZV54uWzUR99OZHJRjlrm3e4HOViQ494x+6BZx82veJqr1JZmvaDJ y30NWpSAGrPpN9fgn/Y/VGQYJCXaffEWZ9pOqQ6rBInWeqT8cxmPTH1mW6lRkn7lMT8v 5HCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="JfII/KYt"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si26509044pgu.150.2019.04.30.04.54.14; Tue, 30 Apr 2019 04:54:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="JfII/KYt"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731416AbfD3Lve (ORCPT + 99 others); Tue, 30 Apr 2019 07:51:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:39332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730995AbfD3Lvb (ORCPT ); Tue, 30 Apr 2019 07:51:31 -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 B94342054F; Tue, 30 Apr 2019 11:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556625090; bh=M2A9iqhs/KVUvfAoeL7RgXhLq80Db758QtOaHvcXZro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JfII/KYtYX0UkgdEsZd5Wx4oWGE7QF6nbC3inm4ZH3RdR2HQVsP5C8tSbF5RBIzT7 1TriJjRYCMzIEV63EbiZfiqVkU2s2WVADdT8ZkvwuohKZmwmGZCG8bo0vghzUGP6ci 5QULi4saBCP2z3gaSZeV08CM1615vNab03ahLhR0= 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 5.0 51/89] slip: make slhc_free() silently accept an error pointer Date: Tue, 30 Apr 2019 13:38:42 +0200 Message-Id: <20190430113612.083040126@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113609.741196396@linuxfoundation.org> References: <20190430113609.741196396@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 )