From patchwork Tue Apr 5 07:20:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 557167 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 5DF97C433FE for ; Tue, 5 Apr 2022 10:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238664AbiDEKs3 (ORCPT ); Tue, 5 Apr 2022 06:48:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244531AbiDEJl1 (ORCPT ); Tue, 5 Apr 2022 05:41:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15D70BB93E; Tue, 5 Apr 2022 02:26:52 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A612D61654; Tue, 5 Apr 2022 09:26:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B18B3C385A0; Tue, 5 Apr 2022 09:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150811; bh=+BHQqudulgEYltZ9gQF+z7ttfxp1/b+/to9PAe+f8pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kDs+QzUhnxoIWik+Z3k+oiNbhE6PgtsiC1s5aKrxIx4xN3Q/YihFl5/6QSgn0fU2Y 4zm35j/6+sWF2NkS7D71iMBMKlZguQ9iRKeatq+CX0B1IAvk2MPPrNvSkpaN6kFjUX tUPHqO7SMl1OykId3y3kUhy5O2bySHJpHcngowYM= 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.15 190/913] selinux: access superblock_security_struct in LSM blob way Date: Tue, 5 Apr 2022 09:20:52 +0200 Message-Id: <20220405070345.553109394@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 baa12d1007c7..0981008ac7d3 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; @@ -2695,7 +2695,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;