Received: by 10.223.185.116 with SMTP id b49csp1113585wrg; Fri, 23 Feb 2018 12:09:36 -0800 (PST) X-Google-Smtp-Source: AH8x226wzVWxOAvPfBYK2lXtOsAsOiWqBeaF8m39l0VRsVjmj9RNmt4t3v83PBdAehMqesW7AN1a X-Received: by 2002:a17:902:8646:: with SMTP id y6-v6mr2814143plt.406.1519416576456; Fri, 23 Feb 2018 12:09:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519416576; cv=none; d=google.com; s=arc-20160816; b=V0awEfE6A167Fjiw7pDDOYY+UGBK/StCOUhlY6wkX9U/4i/LY/uxwYSlD9ygjoMVRZ afGtR3C0NA4qqg+4pt4IKBpLsIkjVnigUyrOKJdDU8Fu9m7gEoQqoTvhGCIbYeQ0xhg8 T6qXZHvEV/dFxUaILjNBSoWK9Q/1cdYo/6jf8JOd+aKWNH36CQxSTgzaBcEH/bACWQXW zvlWgnFd597vrV8a2m2YT5XDDtCYJVUP2QaxDiv9BBoB/fIbKNU01cS/teumgCfGdufM +2uXEavsxLd2j3HdICCuq35utCVMVOvsfSSSugvq9H504eZVtjkd+kBy93D7XvTIwQCA n7kA== 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=yfVbQbtIQgVMFoZBH2deTnToOukNst57HM9Dfc4h114=; b=rdfQbVjYVNogEDbKfGvhzNGIdzR1zZvNJv6FSGGmqXEZIVWFq0di+0EgD5+tgyckM9 2GrKilhZhU3U7+exDorc+PWOBEUmgvXGEMpjydUYWbsc24fOWWR7WQgvtRKENySQAepm BFhIniANAane2Kpvv8mBbcPXt3S6c/qNLn2jQwgpj/gpNj3j/vVd4Kxd1DHHmYLYq/ai RRTqWG/M73g04gygie1agGMIVSuycSvPvhJj83TUCUzcNqKQt+QJ02dv0aj31YTekq/J hqSkuSiqbajIJB7EmOgO7bmgMfo3CyN6A1LB+BT4OWigUVECA4mytPt7P0tQzKwen67J /bRQ== 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 i11si1862217pgq.332.2018.02.23.12.09.22; Fri, 23 Feb 2018 12:09:36 -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 S933103AbeBWSmm (ORCPT + 99 others); Fri, 23 Feb 2018 13:42:42 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41786 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932515AbeBWSme (ORCPT ); Fri, 23 Feb 2018 13:42:34 -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 C404A1017; Fri, 23 Feb 2018 18:42:33 +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.9 015/145] selinux: skip bounded transition processing if the policy isnt loaded Date: Fri, 23 Feb 2018 19:25:21 +0100 Message-Id: <20180223170726.643099866@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170724.669759283@linuxfoundation.org> References: <20180223170724.669759283@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.9-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 @@ -854,6 +854,9 @@ int security_bounded_transition(u32 old_ int index; int rc; + if (!ss_initialized) + return 0; + read_lock(&policy_rwlock); rc = -EINVAL;