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=-7.1 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 81D60C2F3D5 for ; Mon, 21 Jan 2019 14:13:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48FE920861 for ; Mon, 21 Jan 2019 14:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548080028; bh=46JTS+2JaGx7yxohl37+I6+x9BsePGqpV8PJ3w5ty00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=XXb2alTYNiBd5SEGNhGoE7ZiotgVV1c/Pkv9PDCwHPVz7V3H+MRQFkP4F09Ak0HbO +Ne41NU5zaH+viAiJxDVOJUMPL2/77TWqd0XjZcC5K8J4Lft4bCIAXwuYjdikqCr/Y Mo81ftbdb0fVhCR5urMl6Lu0xsA6hPNViuLWGqMI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730514AbfAUONl (ORCPT ); Mon, 21 Jan 2019 09:13:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:36416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729993AbfAUNxB (ORCPT ); Mon, 21 Jan 2019 08:53:01 -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 EE36220879; Mon, 21 Jan 2019 13:52:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078780; bh=46JTS+2JaGx7yxohl37+I6+x9BsePGqpV8PJ3w5ty00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZEnjRefUhm1w5Hdu2wtefm0v0tWuZxh+ZmvsxVlD64djfbKuRcB80T40nQn5o+kAN 4Yn2GsVGwdLmdJOppvqOLgRBkq0eoRqhFTpw11v5Gl5UJXdPxAHEVHeASkd/j+lmoo xJnL6VB/XoYOlHdl7MHyNm5IakCfBbG/WgekRpgs= 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.14 41/59] LSM: Check for NULL cred-security on free Date: Mon, 21 Jan 2019 14:44:06 +0100 Message-Id: <20190121122501.358219812@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122456.529172919@linuxfoundation.org> References: <20190121122456.529172919@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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.14-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 @@ -993,6 +993,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); }