From patchwork Tue Aug 29 21:02:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Casey Schaufler X-Patchwork-Id: 9928319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 59652602B9 for ; Tue, 29 Aug 2017 21:02:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BBAD28A5E for ; Tue, 29 Aug 2017 21:02:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4040128A63; Tue, 29 Aug 2017 21:02:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBCB928A5E for ; Tue, 29 Aug 2017 21:02:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751297AbdH2VC0 (ORCPT ); Tue, 29 Aug 2017 17:02:26 -0400 Received: from nm16-vm3.bullet.mail.ne1.yahoo.com ([98.138.91.146]:41896 "EHLO nm16-vm3.bullet.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751249AbdH2VCZ (ORCPT ); Tue, 29 Aug 2017 17:02:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1504040545; bh=PbCTSlpBG20xdzqDkLqfKJFDrn8dWP8gvP3wK5+eE08=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=X154CHloi73sbNPk2u5X0hIK9SVYI3CacDvANBrW4xvg+CCMVlpiZxtxp/a+7LfWiPYUCaAZ+j7/6P9ameZ7GxHeLmVKNfWwp3SNtAwR4ZqOmKvWn580nzLZYGwUnWD4kyZaQ2mYIH2b3klY87SFjimUc1M9/g1n591unMUdbamlCbt5Vw39X5Ym60meA41+HV8HqVmo3uJSdwRxWHe3yBttiCo/Gj3jWdoDxEm7p/hjafC2IIYNp0fjbgPdv81L9PpsN8SjfvAYSaAoTY6Fz3papSDTLHMvRNCUvzO3TMpOabWjGpgLFL21VtEU7flWYoWcswLQ8HBIc+002pXMww== Received: from [98.138.100.112] by nm16.bullet.mail.ne1.yahoo.com with NNFMP; 29 Aug 2017 21:02:25 -0000 Received: from [98.138.84.42] by tm103.bullet.mail.ne1.yahoo.com with NNFMP; 29 Aug 2017 21:02:25 -0000 Received: from [127.0.0.1] by smtp110.mail.ne1.yahoo.com with NNFMP; 29 Aug 2017 21:02:25 -0000 X-Yahoo-Newman-Id: 171219.89962.bm@smtp110.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: PvDSCJUVM1lQL2_zvH1OjYq5N9ByqI_xrGalchIkWyd5Wwb JhfJPCecBU8i0KYhd0cTwqIXdWO.50Oq9A5F0P9KZHQug3fYQ4R4Qp4lwBFH 9DJDeuy2291v8FUwVnvLbk6oupPYKmNO9WpBhhhjTSVhbQqsjjOzoPbND3Wc sdg._AWje0kYLOo8D3wlAeCQsmI1EDJONokB0YtysygTqBGslmDQbe_uur08 u4AGIS9uxTZ6VbyTpOC2QauCeif9aTj0GtXjlBbTiHE0iqFaKyWNp89AW.gJ mh44kml8wBuSIkwaYFrbiIG64FnQR7ctQdkThU8r4aK2jiEUcfj4Iywzik_L VeGhifn51o618.eCgoPuvXzWnGvo96c8wH9.6rYAV8K0Cbb3jm71s5_yNw2e uBTqgsqcRizYGoqKQPJGqModg7rnyRMBPP97KA9Y0A5EzAi0IkSAukhL9qsF MhAoYUaSe7otFYyMo8EE20P_HXUQkIP3V6jG2Kd69eKQIXMeBuRlZPqVPr8E 6smJXQdwNtyKjBeBl3bBW_3amLZo- X-Yahoo-SMTP: OIJXglSswBDfgLtXluJ6wiAYv6_cnw-- Subject: [PATCH 08/11] LSM: Complete abstraction of superblock blob in Smack To: LSM , James Morris Cc: John Johansen , Tetsuo Handa , Paul Moore , Stephen Smalley , Kees Cook , Casey Schaufler References: From: Casey Schaufler Message-ID: <08804d8e-7385-1989-4c18-eba7592a6ae8@schaufler-ca.com> Date: Tue, 29 Aug 2017 14:02:21 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Subject: [PATCH 08/11] LSM: Complete abstraction of superblock blob in Smack Three cases of the abstraction of the superblock blob where missed in the Smack code. This fixes the omission. Signed-off-by: Casey Schaufler --- security/smack/smack_lsm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 51daf9b05f17..3523072b5548 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -1166,7 +1166,7 @@ static int smack_inode_rename(struct inode *old_inode, */ static int smack_inode_permission(struct inode *inode, int mask) { - struct superblock_smack *sbsp = inode->i_sb->s_security; + struct superblock_smack *sbsp = smack_superblock(inode->i_sb); struct smk_audit_info ad; int no_block = mask & MAY_NOT_BLOCK; int rc; @@ -1408,7 +1408,7 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name) */ if (strcmp(name, XATTR_NAME_SMACK) == 0) { struct super_block *sbp = dentry->d_sb; - struct superblock_smack *sbsp = sbp->s_security; + struct superblock_smack *sbsp = smack_superblock(sbp); isp->smk_inode = sbsp->smk_default; } else if (strcmp(name, XATTR_NAME_SMACKEXEC) == 0) @@ -1683,7 +1683,7 @@ static int smack_mmap_file(struct file *file, isp = smack_inode(file_inode(file)); if (isp->smk_mmap == NULL) return 0; - sbsp = file_inode(file)->i_sb->s_security; + sbsp = smack_superblock(file_inode(file)->i_sb); if (sbsp->smk_flags & SMK_SB_UNTRUSTED && isp->smk_mmap != sbsp->smk_root) return -EACCES;