From patchwork Wed Nov 29 20:43:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10083585 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 6C8286020B for ; Wed, 29 Nov 2017 20:44:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F8E0285D1 for ; Wed, 29 Nov 2017 20:44:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5474529C16; Wed, 29 Nov 2017 20:44:23 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 05F7E29C12 for ; Wed, 29 Nov 2017 20:44:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752638AbdK2UoW (ORCPT ); Wed, 29 Nov 2017 15:44:22 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:33995 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752361AbdK2UoW (ORCPT ); Wed, 29 Nov 2017 15:44:22 -0500 Received: by mail-io0-f196.google.com with SMTP id s19so5166828ioa.1 for ; Wed, 29 Nov 2017 12:44:22 -0800 (PST) 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=Pyvj9hFg3uIU/yD5G8v/C3zRkseIqGj9pNdKrGfPrA0=; b=pET1c8vIhurmYAnLyatEjumEl60AaSz5eDmU+QkmM9lrylM+rsH3gEmYZ47xDNI6a+ QaLzSSYa1jd9rE2di3gEERGnwqiB6noqBxAX543siVTiNrRmqShVrX4+M4+rRSy/4rIO H5vRoTN/LbHSZdPvF/M84vJ3aihCDgaUZTyba5I/EUurRxPgQeRlBqnaJj+R83xc7mx9 zHVElNetGNX5GR+DyJoTp20TPI/nYloUonDRVO4Wj5uy4ci7Lgx4dOqZ2VZ/ToFddQDV +BzIemUrH85oXfs/K9KuI+RnJRGbIBnAv/TyaJufg1LRisKQTaUi9Cfo0oYr6SW261U9 Jfpg== 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=Pyvj9hFg3uIU/yD5G8v/C3zRkseIqGj9pNdKrGfPrA0=; b=hj3TlPG8KpZxRvTC1yJtXAcrJfwofdjr5DUScGSkkTuj/zBCdy7ZUHz7uDIwWt2fM/ CBfIfBSmgtXdp/7qXqRrsXbSgWzksFaTKmMXjOPzu9i5/P08GHvkSpewMCYHDgpu/xHz kPGElZUyD16mi7NPfwNVbWxojz6hdz5LjgYzpdWLGdG6DIP+Ez+k0hOqiApUUPgYwbJf On/hEYDsNkH7zKOOTznQVdZ68K2FK9S3uPH6ReGWsfNmsqeYqJmBzJQSKCaJU/KSkTwp SvKQs07eNBardGRLdu2TwiPXRsqvXJzPpZ5FHvZ+mDHu3GV5WkQSw+vX2tAqMWScyeWT 1NNw== X-Gm-Message-State: AJaThX63E4kq47HtmVgOuDqx3C0F3U5FdyGkmhpBxzgle8j5RgF66IeR pT54DIg6yRIHs8UA8X7P49Y= X-Google-Smtp-Source: AGs4zMbUNPzhMpLGsg4P46LP1sBQ9zxzY0MbLqKHm4vWzo1YRf7GBBYP3QSxw2ZcwhgBvHQ8TMwNYQ== X-Received: by 10.107.59.199 with SMTP id i190mr4821200ioa.97.1511988261648; Wed, 29 Nov 2017 12:44:21 -0800 (PST) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.175.88]) by smtp.gmail.com with ESMTPSA id l4sm1111112ioc.69.2017.11.29.12.44.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Nov 2017 12:44:21 -0800 (PST) From: Eric Biggers To: linux-mtd@lists.infradead.org, Richard Weinberger Cc: linux-fscrypt@vger.kernel.org, Artem Bityutskiy , Adrian Hunter , Eric Biggers Subject: [PATCH v2 5/5] ubifs: switch to fscrypt_prepare_setattr() Date: Wed, 29 Nov 2017 12:43:17 -0800 Message-Id: <20171129204317.91205-6-ebiggers3@gmail.com> X-Mailer: git-send-email 2.15.0.531.g2ccb3012c9-goog In-Reply-To: <20171129204317.91205-1-ebiggers3@gmail.com> References: <20171129204317.91205-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/ubifs/file.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 31dc632a52fc..f5578f1bd170 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1284,13 +1284,9 @@ int ubifs_setattr(struct dentry *dentry, struct iattr *attr) if (err) return err; - if (ubifs_crypt_is_encrypted(inode) && (attr->ia_valid & ATTR_SIZE)) { - err = fscrypt_get_encryption_info(inode); - if (err) - return err; - if (!fscrypt_has_encryption_key(inode)) - return -ENOKEY; - } + err = fscrypt_prepare_setattr(dentry, attr); + if (err) + return err; if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size < inode->i_size) /* Truncation to a smaller size */