Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6264787imu; Mon, 21 Jan 2019 06:04:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN4ejtTAoZJ9BAA2r2knXG5kuOO9NM89Vol37WDwNb7xqci4EDoeb2d6ijGhZByS4wIExO7a X-Received: by 2002:a17:902:4225:: with SMTP id g34mr30938709pld.152.1548079498421; Mon, 21 Jan 2019 06:04:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079498; cv=none; d=google.com; s=arc-20160816; b=adGe/DtaFr6Bgc7JC/bihNvtjzVkpHb2c6NFYlZ02jLscsomWotkUivMJn791e6FyR BlgkvM+zqM2/hZcaZCM+zlYjTWHUOZYGYPod4RyNzHiz4yOh6ecH9AICksHiYJ5An369 UXVI935xQxOA+T9B1mwj5/B6YCJT/JrMYpw/S+sf6yKjic+/QpMjW5RjTSQQIIQy1Cxc 97HXqPaDgIjmjCcNS26t/DgImZRb8O9e+P3WD7CiiPoWia7MBbQ7FUuMu+h4PdRV5/GR mRUWvW87Q4CbJWXcvnaX8AKMjkkfA9hXiAwyBx6ptCYh37mv6wuvE2DK62DW6y6wdc1j jiiA== 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=7wU5KCTouVnJqqT/hIF66m1CEfcnF2qu0vwIcm+UwEk=; b=pU59g1VkCJDR/YgnSpjEITiubnYtaJTVAvqGYTNr20NA7tTvC2pvlBLOovGmVhEe/f Dttrzxfw1MyLSJNrK3cB7PTTsj21GsBhzXHDXvEleFfa1oN4o0AOZxb6rPCi8WV6X5Sd +JhU0MV5JDv4MjcFRbxi/+FbZtHX/lhLP8rN/oSruuRDV+lW7837m94uJ8olHe5+A08c ne43CIekkDLmi1r1TtMfcNUovnmQE89e2y+clleyTusF2gZMKF2NSis/t7lH5DgnM0nd wfBZ9JBhFGhRUhgOPNZl3fH1n2nFOVJg2tRyTDf/I3vN0salNz2Gtu5iu7MDHwPYAgv+ Zggw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rzx1heIH; 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 193si7747519pgc.220.2019.01.21.06.04.41; Mon, 21 Jan 2019 06:04:58 -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=Rzx1heIH; 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 S1732594AbfAUOBN (ORCPT + 99 others); Mon, 21 Jan 2019 09:01:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:48142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732581AbfAUOBK (ORCPT ); Mon, 21 Jan 2019 09:01:10 -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 500162087F; Mon, 21 Jan 2019 14:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079269; bh=WuTaU9eVdZFP9pjF3TqSMaanf/a+dJ3PcVScrjuN0t4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rzx1heIHy6vQA3TwOHH3+/EG28nwez69oX9pCjCWOmF56GYNpiBa2JzHUNZf4fmsN rJMqBUqQIMuzpQf51kzW4I+1XJzjzxXJ134QYpx36ic3al2/Yf5d5nzmCBXERwXAPN zuucQt49wKTdLURGLfkX2ZSJArOAWP8czXk5Hd7Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Casey Schaufler , John Johansen , James Morris , syzbot+69ca07954461f189e808@syzkaller.appspotmail.com Subject: [PATCH 4.19 66/99] LSM: Check for NULL cred-security on free Date: Mon, 21 Jan 2019 14:48:58 +0100 Message-Id: <20190121134916.470893606@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: James Morris commit a5795fd38ee8194451ba3f281f075301a3696ce2 upstream. From: Casey Schaufler Check that the cred security blob has been set before trying to clean it up. There is a case during credential initialization that could result in this. Signed-off-by: Casey Schaufler Acked-by: John Johansen Signed-off-by: James Morris Reported-by: syzbot+69ca07954461f189e808@syzkaller.appspotmail.com Signed-off-by: Greg Kroah-Hartman --- security/security.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/security/security.c +++ b/security/security.c @@ -1003,6 +1003,13 @@ int security_cred_alloc_blank(struct cre void security_cred_free(struct cred *cred) { + /* + * There is a failure case in prepare_creds() that + * may result in a call here with ->security being NULL. + */ + if (unlikely(cred->security == NULL)) + return; + call_void_hook(cred_free, cred); }