Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6250608imu; Mon, 21 Jan 2019 05:51:30 -0800 (PST) X-Google-Smtp-Source: ALg8bN4MFD95zF+Xv/umoQD6OFZQA2ntyrPx+q3Ih7trB0lIuS18D7Nge+WfvPSCKU/JSVWPmtsD X-Received: by 2002:a65:40c5:: with SMTP id u5mr27506141pgp.46.1548078690160; Mon, 21 Jan 2019 05:51:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548078690; cv=none; d=google.com; s=arc-20160816; b=nvdkKKXGSp9PpvVai1OKrWGMBgaRBFwrYqR38DuZjZtdLQ3Mpq47x+Udzf0KpWf9p2 nyEq7+FYuCA81eguMdpkKE0jF0fkhFLg8UycEhhtlWLvtchibCvTZ7HaDSqEkSPqnmZv 7ZWU+ehhVKusJaZWQUC9kI84jNCqkLIhR1abwXENPJjsPJuddl2ubQQ3OlRPqgdVOXJo FrZTvFdCD0Ww5/newGVPOa1YjuFPHJO0W66jnI9skcDsdepLq1q6FKheAc3FO8dX1n+x cGZGTTEAF025Y6oD1ZFrf9KPpgXdI5n3d419mKlm+zojIrx5fPINd9fypcAoVio/6Abv Bxsg== 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=6e1GgRAaIwE2VVGXlBvm2muQJCc8P33yyTRRVi3Te8Q=; b=XcKSjGVtNngmRt5ruChJYHi1vk+aLbdlBwESbDLncyGGSC7134GswOxAJHa4BAH3VX W/CJ0C7N5kK7lXr6QKLbHmcRiVlD9SUrTigcfQC37xIxZRj9LzyjEtRjZjdA18pjhE3l x9DBDG38jhnoL6BLg7gHqEWkVM5AKEsajjyAHdw9c5In+c9151sYk0ldB6wvOZlxjmEb AZhLfQBiedjpAJ086TgLpVUPGW/JJE4zDziousnl90vjDcd+qZ2ESQS2UMTKI82b6Ivi fEhHnCS9SrD2NZOzUF3jWret41Nvxs2dZ8kHkRS1eq6rGB8qWuNZXp5t+UDBO+njwr8F 0KgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eYN7QttQ; 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 t13si13158427pgm.175.2019.01.21.05.51.12; Mon, 21 Jan 2019 05:51:30 -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=eYN7QttQ; 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 S1730258AbfAUNtc (ORCPT + 99 others); Mon, 21 Jan 2019 08:49:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:60128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729694AbfAUNta (ORCPT ); Mon, 21 Jan 2019 08:49:30 -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 969F62087F; Mon, 21 Jan 2019 13:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078570; bh=zDBXxGwymfoZx8GjJK24ZaDDbDTh6vsJLQfHB4KGmpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eYN7QttQpEDPTMrPf7oNiyfMzukz4rn/1S2qu0de9qXiJmYXLrJtXKBo5JGzXzUTk dDqwphiP10e0LPklWDBMDpKwEK3TdyD9VzLgZt626r6Wc1iYFHfCbAfQgNHzAG8j4E 2EqmN2tWoMMaVADpvZqHT/hWLwgy+QEvty/VrlTo= 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.20 077/111] LSM: Check for NULL cred-security on free Date: Mon, 21 Jan 2019 14:43:11 +0100 Message-Id: <20190121122504.885710118@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: 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 @@ -1014,6 +1014,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); }