From nobody Tue Jun 30 04:50:41 2026 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 CA531C433FE for ; Tue, 25 Jan 2022 07:15:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443533AbiAYHPV (ORCPT ); Tue, 25 Jan 2022 02:15:21 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:30301 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442940AbiAYHM3 (ORCPT ); Tue, 25 Jan 2022 02:12:29 -0500 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JjdLs2xN3zbkF5; Tue, 25 Jan 2022 15:11:33 +0800 (CST) Received: from dggpemm500016.china.huawei.com (7.185.36.25) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 25 Jan 2022 15:12:22 +0800 Received: from huawei.com (10.67.174.102) by dggpemm500016.china.huawei.com (7.185.36.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 25 Jan 2022 15:12:22 +0800 From: "GONG, Ruiqi" To: Paul Moore , Stephen Smalley , Eric Paris CC: Ondrej Mosnacek , Anna Schumaker , Olga Kornievskaia , , , Wang Weiyang , Xiu Jianfeng Subject: [PATCH -next] selinux: access superblock_security_struct in LSM blob way Date: Tue, 25 Jan 2022 15:11:33 +0800 Message-ID: <20220125071133.188172-1-gongruiqi1@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.102] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500016.china.huawei.com (7.185.36.25) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 xat= tr 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 --- 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 5b6895e4fc29..a0243bae8423 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -479,7 +479,7 @@ static int selinux_is_sblabel_mnt(struct super_block *s= b) =20 static int sb_check_xattr_support(struct super_block *sb) { - struct superblock_security_struct *sbsec =3D sb->s_security; + struct superblock_security_struct *sbsec =3D selinux_superblock(sb); struct dentry *root =3D sb->s_root; struct inode *root_inode =3D d_backing_inode(root); u32 sid; @@ -2647,7 +2647,7 @@ static int selinux_sb_eat_lsm_opts(char *options, voi= d **mnt_opts) static int selinux_sb_mnt_opts_compat(struct super_block *sb, void *mnt_op= ts) { struct selinux_mnt_opts *opts =3D mnt_opts; - struct superblock_security_struct *sbsec =3D sb->s_security; + struct superblock_security_struct *sbsec =3D selinux_superblock(sb); u32 sid; int rc; =20 --=20 2.17.1