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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 471DCC433FE for ; Tue, 5 Apr 2022 11:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378041AbiDELbY (ORCPT ); Tue, 5 Apr 2022 07:31:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244167AbiDEIvr (ORCPT ); Tue, 5 Apr 2022 04:51:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5894BD3ACB; Tue, 5 Apr 2022 01:40:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A3B1BB81C69; Tue, 5 Apr 2022 08:40:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8EB8C385A1; Tue, 5 Apr 2022 08:40:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148005; bh=bd6rYXGYbU0BS3hg2ZtondeDJ5v2EGuiw/BaeVtysrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MSGPNXrFILqifhP6JY4ZPJ+/qlFxYCgDwIzwWDQRKOTLRPgdrOUtsIwT3SFhWxh7z hjALd92c2Sf/HXAHknX1fXVAzcwHnpqWZ3kUTLosSxTIUnPMqo+9JExUcz+O9Pd6g4 ar8bKQMXDcrV1DTGyo/70YEJDGUAbkQ9LQ8E0bo8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "GONG, Ruiqi" , Casey Schaufler , Paul Moore , Sasha Levin , GONG@vger.kernel.org Subject: [PATCH 5.16 0201/1017] selinux: access superblock_security_struct in LSM blob way Date: Tue, 5 Apr 2022 09:18:34 +0200 Message-Id: <20220405070400.216504660@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: GONG, Ruiqi [ Upstream commit 0266c25e7c2821181b610595df42cbca6bc93cb8 ] LSM blob has been involved for superblock's security struct. So fix the remaining direct access to sb->s_security by using the LSM blob mechanism. Fixes: 08abe46b2cfc ("selinux: fall back to SECURITY_FS_USE_GENFS if no xattr support") Fixes: 69c4a42d72eb ("lsm,selinux: add new hook to compare new mount to an existing mount") Signed-off-by: GONG, Ruiqi Reviewed-by: Casey Schaufler Signed-off-by: Paul Moore Signed-off-by: Sasha Levin --- security/selinux/hooks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 49b4f59db35e..5b4b738a3be4 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -492,7 +492,7 @@ static int selinux_is_sblabel_mnt(struct super_block *sb) static int sb_check_xattr_support(struct super_block *sb) { - struct superblock_security_struct *sbsec = sb->s_security; + struct superblock_security_struct *sbsec = selinux_superblock(sb); struct dentry *root = sb->s_root; struct inode *root_inode = d_backing_inode(root); u32 sid; @@ -2696,7 +2696,7 @@ static int selinux_sb_eat_lsm_opts(char *options, void **mnt_opts) static int selinux_sb_mnt_opts_compat(struct super_block *sb, void *mnt_opts) { struct selinux_mnt_opts *opts = mnt_opts; - struct superblock_security_struct *sbsec = sb->s_security; + struct superblock_security_struct *sbsec = selinux_superblock(sb); u32 sid; int rc; -- 2.34.1