From patchwork Wed Sep 20 22:45:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9962821 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 081EA6056A for ; Wed, 20 Sep 2017 22:48:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF1AF28925 for ; Wed, 20 Sep 2017 22:48:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E388B290DB; Wed, 20 Sep 2017 22:48:57 +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, FREEMAIL_FROM, 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 A509728A28 for ; Wed, 20 Sep 2017 22:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751622AbdITWsy (ORCPT ); Wed, 20 Sep 2017 18:48:54 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33739 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751937AbdITWrF (ORCPT ); Wed, 20 Sep 2017 18:47:05 -0400 Received: by mail-pg0-f68.google.com with SMTP id i130so2381453pgc.0; Wed, 20 Sep 2017 15:47:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Qwl8pXoUQ+pxfRR5zWcCq2FLYmToeYnmgMTcVFokUF4=; b=Q89+YTOgMuzQDhgqeYooAHwEcdoQV02UXDz8Dj3gBVDyoxoGgtbQpmic4gvyxq0CIX Fsm64qFTcYzjUuR/kG9ZmZjjUhkqplTzkRMqTjiC+frcvHgNFKtoNZqoTPibReIdS/VQ hFzFwccG5rcwvBbIKTA3BsHFoShy7k2gzR7RsqSn108WmlHPUtzYRlGohAEY+mfwCVVK uV5KBjuOZu6+OgoF+HR6g7v096e5qkOq718eLJ+uhDaoOMbfZ0emo+paCAKDHcr+1G2u J2KCOk+vbtnULsQHSPUPBmJSTPOhBd5xIksY0pw3eQOOxuq63s5UGQNBKx/WLE2pyYvB Nelg== 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:in-reply-to :references; bh=Qwl8pXoUQ+pxfRR5zWcCq2FLYmToeYnmgMTcVFokUF4=; b=jgrcUIgcA4kqthSU/zOGSOHlB88/yood2wDyLcrvhCk3fCBzib1NAfemogoMnbgf9K 803jBlvTATjPpmBJJh23rXFZIC3efOABwgRZHCtUNsWhrgGzMWAwm9kaot6qeVa2C9le G1uBtlp8neH9iyiurvBv0qJMQ9EQA9Fm1eV9uibyzc1Yu3ZnjHS5y9UpoWdQJ51gVJ/J kYoQr3GmEExm8Faim6mx3SVT8aBrJ0G2bnEWJlCaaQCweCMgrRqShsprrAqUC/alvd/z EC5tHfeyOhDt405ufq0IWZmpgx8amHfRqZcXdiO4geDNbP3donzeZtRQQO5x+X/Ll/aV hO7Q== X-Gm-Message-State: AHPjjUj4af6NAU99KyEpaDXPJl0ReWJdXRj3WXmSIo2EmQJ7K2yUBYQ+ +KgSb2CXKR+naHWD6P0M6OnygCbEvjw= X-Google-Smtp-Source: AOwi7QDFXZ2439vcnJ9WZk60CMGePez6f78La2iR4Krkm3RiBPhfLQixSRAI1TuDZVIWwbTE7PvC5A== X-Received: by 10.99.142.196 with SMTP id k187mr3828125pge.14.1505947624634; Wed, 20 Sep 2017 15:47:04 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.81]) by smtp.gmail.com with ESMTPSA id j2sm6249pgn.26.2017.09.20.15.47.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Sep 2017 15:47:04 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, "Theodore Y . Ts'o" , Jaegeuk Kim , Michael Halcrow , Eric Biggers Subject: [PATCH 12/25] ext4: switch to fscrypt_prepare_link() Date: Wed, 20 Sep 2017 15:45:52 -0700 Message-Id: <20170920224605.22030-13-ebiggers3@gmail.com> X-Mailer: git-send-email 2.14.1.821.g8fa685d3b7-goog In-Reply-To: <20170920224605.22030-1-ebiggers3@gmail.com> References: <20170920224605.22030-1-ebiggers3@gmail.com> 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 From: Eric Biggers Signed-off-by: Eric Biggers --- fs/ext4/namei.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index c1cf020d1889..b2058500f1dc 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -3221,9 +3221,10 @@ static int ext4_link(struct dentry *old_dentry, if (inode->i_nlink >= EXT4_LINK_MAX) return -EMLINK; - if (ext4_encrypted_inode(dir) && - !fscrypt_has_permitted_context(dir, inode)) - return -EPERM; + + err = fscrypt_prepare_link(old_dentry, dir, dentry); + if (err) + return err; if ((ext4_test_inode_flag(dir, EXT4_INODE_PROJINHERIT)) && (!projid_eq(EXT4_I(dir)->i_projid,