Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1210855iol; Fri, 10 Jun 2022 02:40:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYZUH3mGjgOzxpOvtIPaQtQnlWyum0DeQK4wvQMIVvfF9WPoxhfmWFaPg6YLJsZv8z0zwO X-Received: by 2002:a63:b51:0:b0:3fc:cd1d:884 with SMTP id a17-20020a630b51000000b003fccd1d0884mr38698398pgl.98.1654854002813; Fri, 10 Jun 2022 02:40:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654854002; cv=none; d=google.com; s=arc-20160816; b=khoOfksVTnFYmGtSrlUZr3nV0n/V8vKkyyqO08r0fgCZVC0VzyFMy7JiqIO13nv9qA pzmCqjm/vd3CuFz1pRQcifNENchv0DkpR2w3YWNJn2f9djvNjz9Sy5U0pFMAL1HGdzrt ZcxUEPrc8DEbSTHv0W1tPPqbRs6HwRSYvGCcRjq5w0muO9QDMWwQX8eblNZS8c5+irqs m9xHXdU9s879NCyeFVMK3mD0qcWStVZUUj8CA6f1Glm4rmoNIofB2ggS+GdmLNh+5iXE HeCDIhL38ubQd2chWYpdNjAszH12TXDJUV68ibJIv30NgKv6DtFDDfjPQUGx4LdIg+oP ZbLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=ZbX07TDP9fd8W82ozJ8Z1bA/cleixp0tt2T+lshnyI0=; b=DWST7MGJYUyzAjv5EIkW/EWi5D3B++mSZVdmFo0YiCdx3nVNNAFT2aswxOG6XuyCsL dUiJemFuBbxvVKar5yhkV2L5dITFSEkQYfw8O3gkavBwmDJT28q9jYNVB4B0dbBvEUxO CaQ6ZtiUe+/YRp3rD8UvSZ60ZSWAGnheJBeNe1Ohsm1pEIZH/dNLAk6HDl8z+LfCv+AW 4mvkz4vqc4MBvdDy0iEX9LLuAGoT62f+mEK5aNAb5fejcpJma8bN3YSC3u41fZJrJSKj MElb15eRsjutMZC2fv8UYZIAjcc+nwfhnhUBJuL+XTZElELnJezv8k/W1/7x6BqN7WcT CDxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l73-20020a63914c000000b003fe0f4990ddsi12047857pge.255.2022.06.10.02.39.49; Fri, 10 Jun 2022 02:40:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349200AbiFJJ1n (ORCPT + 99 others); Fri, 10 Jun 2022 05:27:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349202AbiFJJ1M (ORCPT ); Fri, 10 Jun 2022 05:27:12 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F86A2F662; Fri, 10 Jun 2022 02:25:04 -0700 (PDT) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LKFsj5FkDz9sxF; Fri, 10 Jun 2022 17:24:41 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.58) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 10 Jun 2022 17:25:02 +0800 From: Xiu Jianfeng To: , , CC: , Subject: [PATCH -next] smack: Remove the redundant lsm_inode_alloc Date: Fri, 10 Jun 2022 17:23:07 +0800 Message-ID: <20220610092307.30311-1-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.174.58] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500023.china.huawei.com (7.185.36.114) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's not possible for inode->i_security to be NULL here because every inode will call inode_init_always and then lsm_inode_alloc to alloc memory for inode->security, this is what LSM infrastructure management do, so remove this redundant code. Signed-off-by: Xiu Jianfeng --- security/smack/smack_lsm.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 6207762dbdb1..001831458fa2 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -766,13 +766,6 @@ static int smack_set_mnt_opts(struct super_block *sb, if (sp->smk_flags & SMK_SB_INITIALIZED) return 0; - if (inode->i_security == NULL) { - int rc = lsm_inode_alloc(inode); - - if (rc) - return rc; - } - if (!smack_privileged(CAP_MAC_ADMIN)) { /* * Unprivileged mounts don't get to specify Smack values. -- 2.17.1