Received: by 10.223.185.116 with SMTP id b49csp1084597wrg; Fri, 23 Feb 2018 11:38:53 -0800 (PST) X-Google-Smtp-Source: AH8x226Fsj9UBpz77UfVkvJHXzbd87OWyYTSqjczee/ej2S8fULiWnm+yuZouORfRPiQHdhwNIt6 X-Received: by 10.99.163.1 with SMTP id s1mr2286926pge.47.1519414732900; Fri, 23 Feb 2018 11:38:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519414732; cv=none; d=google.com; s=arc-20160816; b=Z/huYRCyCZKJQxBbgwV81recbEAci1UIRqyhTXOyVoX4dhjul4nzNxiUs6EfSwvOJ1 G0uanTLtXBRFCi1qpwOYgcCIhKANcTHIbU99tTBB7Sj+42t7SttSG8RyHwn24k1SysLO DGBT03GOWfPjh8dEgMyNlLF4dCcARf5ANce2fF2OglsvTRg88yVV5fNQDLmi0enVf9zb 3MJU6euu3UKrlcGY+4YS9bJokxhH78+gfVWeoUEySY9Bqi1Y1lKwQ8uT/fNon+0gqm6x C7EiPBwBC2Z1LVrno7TT3UYkj+uZWud+AsmilLPVN0JhgMgUbCvZBG6KaBbs6B6Qz2Pz Hqsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+2zEvDLFXc2r+hnVzrH3IMgCCrOSSnywxXqhRXC1tvg=; b=s2ycsYJwTyiA6TnxfoNgMnniNiqsv66MdMEum+CY2/TMgZDbH60gVb7nBQ5uYNG9eq ls/6cMjfJgIIegUV0IQsZW9zmLXFoxugjVjQ/YcT48x5VIQfllggOZ23QtUHIdEW4wHV jpKZGqnLPifCaWja048SdjQqojMRdIrfCAD2eD8hzEs60o/QoYkgUyY2hocuyEX9J7+V gIqFT1oIlCjjIqZZhwgULhG01AoihPnYujkEuHDMy7zweQYH3aAkyfiySTpjmQ7K2asf yH5OKBl3RF/BCG7AvjFOWiV6TGUFBi2urYSA0O7unvTv1S8fBuZWbwz1q+yUfpDZFvnN ftKw== ARC-Authentication-Results: i=1; mx.google.com; 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 q5si2193306pff.398.2018.02.23.11.38.15; Fri, 23 Feb 2018 11:38:52 -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; 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 S1754754AbeBWThh (ORCPT + 99 others); Fri, 23 Feb 2018 14:37:37 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45564 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934691AbeBWSuQ (ORCPT ); Fri, 23 Feb 2018 13:50:16 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 390C011C3; Fri, 23 Feb 2018 18:50:16 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Paul Moore , Stephen Smalley , James Morris Subject: [PATCH 4.14 027/159] selinux: skip bounded transition processing if the policy isnt loaded Date: Fri, 23 Feb 2018 19:25:35 +0100 Message-Id: <20180223170746.479384159@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170743.086611315@linuxfoundation.org> References: <20180223170743.086611315@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paul Moore commit 4b14752ec4e0d87126e636384cf37c8dd9df157c upstream. We can't do anything reasonable in security_bounded_transition() if we don't have a policy loaded, and in fact we could run into problems with some of the code inside expecting a policy. Fix these problems like we do many others in security/selinux/ss/services.c by checking to see if the policy is loaded (ss_initialized) and returning quickly if it isn't. Reported-by: syzbot Signed-off-by: Paul Moore Acked-by: Stephen Smalley Reviewed-by: James Morris Signed-off-by: Greg Kroah-Hartman --- security/selinux/ss/services.c | 3 +++ 1 file changed, 3 insertions(+) --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -867,6 +867,9 @@ int security_bounded_transition(u32 old_ int index; int rc; + if (!ss_initialized) + return 0; + read_lock(&policy_rwlock); rc = -EINVAL;