Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1618864ybv; Fri, 21 Feb 2020 00:24:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzHdP6VUZbvfDeBIq2DgyHQs6eoiD3/4mYrUnXzRMs/T4agbS8XPA6sqK07c+tnqmqBNNNp X-Received: by 2002:a9d:67d7:: with SMTP id c23mr27250576otn.262.1582273451827; Fri, 21 Feb 2020 00:24:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273451; cv=none; d=google.com; s=arc-20160816; b=aeHyXGhwCfj9Tlj97DKc5Xb02pJGVLvvjMKjRYbAeI/keQ+EiAR7p45kjFdZkZseuQ B9hVPxdSU8sOPMrDz4Fdepj/WM8ZE2bcajyS4N3Og+I8u+bfC+hLLRGBf74yFe6Xx0Ai QUevC/RARxymiT09LGy3Iu3+nwnQrWyipjlXqoT9SH9I2Atx83TCzY+9uKTaR9odUmAQ 8Mp9Vd/4SxenxcMeADIt9zgNKehMGBxivNaiQITx40zBFfltgiH2rwvHtI3PDyzQdMuR RA9HS36zGf91/Zl3Yo9jgicOFgGPmgHq311g/xWNNY0HpCTciU3wk9eVSN2DL4pm9vDY nRtQ== 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=L2lwnNP9ohql2xVpUfyGg6fcEzQHTMI5cJOQlclH9uU=; b=FX7NtxdpohRLN4rsz35M0gy8yr3wdCV+ULEyLkj42RYoclbx3oJBmH5Rsm8rD40JCN ApA3UqKzs58dPF0rXnvQMdIMaVGcNYC5uObPQ/6x4CfzSQ9mL15KLl42o7zCxFJS+xnu 2sZr6CXcykQ6nXmQniEGUtjdYbysFoEVRg/6QWcHuZq984UaGyuJv6B25pyq/xQSptmq eKNezu4On80vCjixaiVOYGAiBtQU9Q7EUIf2u4D68l/BCCxkLZbAKV82j6HYrpzKjYkA g0H4VVvk1t8+O5sqdQrUM6nzPZTxo2YU3h89YNNJ+BTn65YisGgUz0oJs7X256VNZVjt h+BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MTFnTVVc; 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 z1si1128714otq.21.2020.02.21.00.23.59; Fri, 21 Feb 2020 00:24:11 -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=MTFnTVVc; 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 S2388280AbgBUIWT (ORCPT + 99 others); Fri, 21 Feb 2020 03:22:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:33876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388272AbgBUIWS (ORCPT ); Fri, 21 Feb 2020 03:22:18 -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 526F324672; Fri, 21 Feb 2020 08:22:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273337; bh=JyqHc7oHZofqx/5w0IE55UzicqWG+qZhwSUz1m9zPm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MTFnTVVcIcIjEouavm90l82c6mYGk1OVYiSuS3TcAUVNOevx3GKHJYJFk58pqcE+O 8PfGCRXD8z0ak3vBRNOHQa0dNzSLVYwyipHNKe10qMdrM/mNkODpZyl1qsrMMOCHeU VdWyrNAq/5cVzQPjcLkcBzuWXy0mZ1F5QkTaEgoE= 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 4.19 085/191] selinux: ensure we cleanup the internal AVC counters on error in avc_update() Date: Fri, 21 Feb 2020 08:40:58 +0100 Message-Id: <20200221072301.396268238@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@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 83eef39c8a799..d52be7b9f08c8 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c @@ -896,7 +896,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