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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,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 43049C35641 for ; Fri, 21 Feb 2020 08:07:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1971020722 for ; Fri, 21 Feb 2020 08:07:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582272465; bh=Du1mF7eeMg+m+or7MrRy+2BjnUnht8x6SX8IIkgj73U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=esn02bYtamF3dEApYb8xjSKiJeWl2jTLtBwxYAzc7syeKG7ucZ7hcu7LM5VaRxsnx tRje80hydFi5zTkMYAhpaAk9rzIxih52ZnCOB7MBOWFhwLW+HRJu3OW41MBxizV8w2 EmpwLtKxJGMTbrd0qp0ZSFZHcKGqR9RkrsJ6hgb4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732095AbgBUIHo (ORCPT ); Fri, 21 Feb 2020 03:07:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:41954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732086AbgBUIHl (ORCPT ); Fri, 21 Feb 2020 03:07:41 -0500 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 B0BF320722; Fri, 21 Feb 2020 08:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582272460; bh=Du1mF7eeMg+m+or7MrRy+2BjnUnht8x6SX8IIkgj73U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xVBuXltBL9ciMT5dx87h4seuOBLpG+eGzmYdsaimsfe8ollkh23M+o3ua6AqDV3Pm fVwa8lsdH9GXMqHPxRTRfiiR8xsqNKpomG2PaKLRR3liTQY4ihUaWp5RhQWcxde8y8 3XJt+2K6BjfO04FEOW76nRsepPbVosgrZ6NdcphQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaihind Yadav , Ravi Kumar Siddojigari , Paul Moore , Sasha Levin Subject: [PATCH 5.4 152/344] selinux: ensure we cleanup the internal AVC counters on error in avc_update() Date: Fri, 21 Feb 2020 08:39:11 +0100 Message-Id: <20200221072402.605020001@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072349.335551332@linuxfoundation.org> References: <20200221072349.335551332@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: Jaihind Yadav [ Upstream commit 030b995ad9ece9fa2d218af4429c1c78c2342096 ] In AVC update we don't call avc_node_kill() when avc_xperms_populate() fails, resulting in the avc->avc_cache.active_nodes counter having a false value. In last patch this changes was missed , so correcting it. Fixes: fa1aa143ac4a ("selinux: extended permissions for ioctls") Signed-off-by: Jaihind Yadav Signed-off-by: Ravi Kumar Siddojigari [PM: merge fuzz, minor description cleanup] Signed-off-by: Paul Moore Signed-off-by: Sasha Levin --- security/selinux/avc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 6646300f7ccb2..d18cb32a242ae 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c @@ -891,7 +891,7 @@ static int avc_update_node(struct selinux_avc *avc, if (orig->ae.xp_node) { rc = avc_xperms_populate(node, orig->ae.xp_node); if (rc) { - kmem_cache_free(avc_node_cachep, node); + avc_node_kill(avc, node); goto out_unlock; } } -- 2.20.1