From patchwork Thu Jul 6 02:38:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tahsin Erdogan X-Patchwork-Id: 9827479 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 70908603B5 for ; Thu, 6 Jul 2017 02:38:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EBFB26E55 for ; Thu, 6 Jul 2017 02:38:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52D3C2857F; Thu, 6 Jul 2017 02:38:50 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 3800128574 for ; Thu, 6 Jul 2017 02:38:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752632AbdGFCiZ (ORCPT ); Wed, 5 Jul 2017 22:38:25 -0400 Received: from mail-pf0-f173.google.com ([209.85.192.173]:34184 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752480AbdGFCiY (ORCPT ); Wed, 5 Jul 2017 22:38:24 -0400 Received: by mail-pf0-f173.google.com with SMTP id q85so3762227pfq.1 for ; Wed, 05 Jul 2017 19:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=f5O94F1yaGIdH6pOiB6+SEYKQbIh1LL3d6FnpocLPGw=; b=nPUrXEgBt4XPDycDGqadlArtO0YADx26lIdxkI8PFCp1CnmlebbYAW3T8SYPZHw4/m h2YMHXlGmSkBZxjzgRUqy8zUQjFvNuS4qkAil88AW9kFmZIj7quDBDrFL/aw8sX76fT1 TY0ApvCilL4yeNcCFntJkZfujpM7cxrHYZksdtNicjW8FWHYUVD8WZ/pqS95V8aos5oM lPJ4uaUxbX/ZRoGmShooYG6J/LRksvAiPkORZpU9k+RF5Q58SR639tg47Lh3n4aP0zIt gpDUizfAaP07zSkoUG/AO16ROIFpSx7tLbqabqoD3AZM1kyODxlQcJU0WlREdht0reF8 BnUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=f5O94F1yaGIdH6pOiB6+SEYKQbIh1LL3d6FnpocLPGw=; b=D7B0ATexRodd5B+xAWmqydHAmdW/XdIXnmCx6FNVXn99Me9QeZ6QJHDB5mM9X8X7jl t9t/8IJplJtr3OIwvOdtabUmFpr9TXSsRpaROoifgU6l7vBXA+kPiD4WiQF8gwPdX6Kq K3B/oXp9Bmelv2dzASvguCoeFduMBzqH1ZhGjnLwFdlwcxkcMe0QQuEiwlRO22R1UWRm zvPuN8rO+MD8AjLYB+gJoA+vjJ9yCJ0lf7F7J/qiTbggwcP/rPOJoijbfs/hZu0WILuI hdHSFNiccawZdebKErVgTPBi8bg6M9PoNaHykTx05AvwYqBL0SSCbejLxoyYiV06ngmo OiTQ== X-Gm-Message-State: AIVw110HdrGGh51CfWBnQR0cePYjuptbII8gpi6mSLTmMcF2Q0p5nY7L 3GEtccBKzW7k/4ef X-Received: by 10.98.68.156 with SMTP id m28mr23022893pfi.159.1499308703082; Wed, 05 Jul 2017 19:38:23 -0700 (PDT) Received: from tahsin1.svl.corp.google.com ([100.123.230.167]) by smtp.gmail.com with ESMTPSA id o62sm812398pfg.120.2017.07.05.19.38.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Jul 2017 19:38:22 -0700 (PDT) From: Tahsin Erdogan To: Theodore Ts'o , Jaegeuk Kim , Andreas Dilger , linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Tahsin Erdogan Subject: [PATCH 1/2] ext4: skip ext4_init_security() and encryption on ea_inodes Date: Wed, 5 Jul 2017 19:38:18 -0700 Message-Id: <20170706023819.32272-1-tahsin@google.com> X-Mailer: git-send-email 2.13.2.725.g09c95d1e9-goog Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Extended attribute inodes are internal to ext4. Adding encryption/security related attributes on them would mean dealing with nested calls into ea code. Since they have no direct exposure to user mode, just avoid creating ea entries for them. Signed-off-by: Tahsin Erdogan --- fs/ext4/ialloc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index fb1b3df17f6e..0c79e3efcaf7 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -771,7 +771,8 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, if ((ext4_encrypted_inode(dir) || DUMMY_ENCRYPTION_ENABLED(EXT4_SB(dir->i_sb))) && - (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) { + (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) && + !(i_flags & EXT4_EA_INODE_FL)) { err = fscrypt_get_encryption_info(dir); if (err) return ERR_PTR(err); @@ -1114,11 +1115,11 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, err = ext4_init_acl(handle, inode, dir); if (err) goto fail_free_drop; - } - err = ext4_init_security(handle, inode, dir, qstr); - if (err) - goto fail_free_drop; + err = ext4_init_security(handle, inode, dir, qstr); + if (err) + goto fail_free_drop; + } if (ext4_has_feature_extents(sb)) { /* set extent flag only for directory, file and normal symlink*/