Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6251877imu; Mon, 21 Jan 2019 05:52:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN5FBpKTGAoZKgtBG3WxsgaO3fq0biRvfJs1ywrxul7gH42D0QqZQl2j7Ut7LvJ2iZbMUZot X-Received: by 2002:a62:ab0d:: with SMTP id p13mr29859719pff.211.1548078772020; Mon, 21 Jan 2019 05:52:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548078771; cv=none; d=google.com; s=arc-20160816; b=frTGLGgZjBkDt5jQ8T9oi3mDxkNnWviIEb6XhFYcZu08GNCs7CXo6OvYv8pbgb8Gpb Prgv85X4tW5OmiAtTm/Y2Yo4zW52YZ95Y7UrerPWjSTSOH8vRdxdCSODAoHMdkSGXVvm 5JePuu4cH3r3UME+WjFkd7/ifgQgMnNkOI8pfKOsxyzw8Ts3gj3NI5tfoOJkU0P0eeK7 R/0+7+eW8w1Yi268MC2FHAR1bpCVq1Gc1FxZFDvzNcxYCfXXQviN4b1iQrEpqM5zOnGF mfsJjPHeqag0sl6b2R0kpzejl+jgbdZVUAt1zd2HehY7OXxN6NhszwD8WqKFk+pXqrCL +o2g== 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=wj5wtbh9S98IS/ayCTtXkcGlcb2T1CSvWdUpR6D7tO4=; b=dU9ABfeinfYs3JEX8RJHbtWxfBHh69TX3ghxYWXIqjaTD4nFGYLAs4LBVpTEgIPea5 DLu3ok7XfqT23g4KqEWxZbRaLEw68oTHWnh3TbnmtDtX4AwiJwFn7/1MjFHlRVj7eQbq QVpkOyky0x1XGhH2ZKs8msEzbeQo1VUnFPHaxSiq0TqUoOCdn3bE7+BTwg1cfGiCRTId jMAmh3PKLREEeQbFfxDqD4NHFiN1ERy5564VBvd9HZ/ixV2e8vBP/RleYlpjMXw2jmoT bXeGPxIk5joyk/4xM+HozllxCnLasyWVgC2shobAOBWa7mrYjVwg5+7JAyAeKdRTDK4m 0ylQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Xz/AzdTC"; 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 ay4si13255090plb.235.2019.01.21.05.52.35; Mon, 21 Jan 2019 05:52:51 -0800 (PST) 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="Xz/AzdTC"; 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 S1730407AbfAUNtw (ORCPT + 99 others); Mon, 21 Jan 2019 08:49:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:60580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730380AbfAUNtu (ORCPT ); Mon, 21 Jan 2019 08:49:50 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 C5C7A20861; Mon, 21 Jan 2019 13:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078590; bh=zMcXSkkqS1g6gk6cAGN6H5KrY7Fw3eG3BGc0+dVgO1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xz/AzdTCDKHxr/qF+9zuz+1AkIlsKAvk9ArWB5lsb1OBPLpj4DR8oPZ6S+5VzNlb6 SfEk7oP4VkDKxayLzs463EyC5uhBRmA0C9FuuaJ0uNwTrh3zK/qrdnuAlX1o1mrnVc LArTS/FAuxOFv3sVEUKqKutCLMzCB+IVbchb9tSc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+6664500f0f18f07a5c0e@syzkaller.appspotmail.com, Stephen Smalley , Paul Moore Subject: [PATCH 4.20 084/111] selinux: fix GPF on invalid policy Date: Mon, 21 Jan 2019 14:43:18 +0100 Message-Id: <20190121122505.443434965@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122455.819406896@linuxfoundation.org> References: <20190121122455.819406896@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stephen Smalley commit 5b0e7310a2a33c06edc7eb81ffc521af9b2c5610 upstream. levdatum->level can be NULL if we encounter an error while loading the policy during sens_read prior to initializing it. Make sure sens_destroy handles that case correctly. Reported-by: syzbot+6664500f0f18f07a5c0e@syzkaller.appspotmail.com Signed-off-by: Stephen Smalley Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman --- security/selinux/ss/policydb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -732,7 +732,8 @@ static int sens_destroy(void *key, void kfree(key); if (datum) { levdatum = datum; - ebitmap_destroy(&levdatum->level->cat); + if (levdatum->level) + ebitmap_destroy(&levdatum->level->cat); kfree(levdatum->level); } kfree(datum);