From patchwork Wed Sep 20 22:46:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9962779 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 DEA6E6056A for ; Wed, 20 Sep 2017 22:47:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF1DE290DB for ; Wed, 20 Sep 2017 22:47:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C41CA29158; Wed, 20 Sep 2017 22:47:45 +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 7C5342924A for ; Wed, 20 Sep 2017 22:47:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752061AbdITWrU (ORCPT ); Wed, 20 Sep 2017 18:47:20 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34787 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751795AbdITWrT (ORCPT ); Wed, 20 Sep 2017 18:47:19 -0400 Received: by mail-pg0-f68.google.com with SMTP id u18so2379156pgo.1; Wed, 20 Sep 2017 15:47:18 -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=XznOxbscM+Guz7zyOXZEtQLXMiA7EjYNtJ+c92S6E2g=; b=D7tzOiAIDtv8O95WdUO+BrCXDAqYvOu/MKUWr37+QByGJrRobenputFeMHEpiaySTl 7TLsHNYVt47q/lOQNhZXqh3gKoh7aKBQZprHH5mh0tcqg00qWbtsALNb1HWDU7cazncd xTlQdxPoCX+RLwN8BeZ01amwu9pEh8KCvv7N/HxC454CErpqQ5X5JhqDXPDvr4356a+e 0nahPMHmsXWTsQBPIzi4RQbIQMg9sNCJBbXJY8+2DGjsLjlX0YDWxaIg6a/uhrRlEdvi 1Wueop06sTeqrEA3+lDz/mCTsoefwLN5idbCiTzF9zdj9acZ08PFZFHUF1AElMPquEBg cVRQ== 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=XznOxbscM+Guz7zyOXZEtQLXMiA7EjYNtJ+c92S6E2g=; b=CRBHQeU3Kto01VB/HhqeOSZKqe8vo2UzyHy5vn4s+GgJ1Gh02aTWNskhP0sydxs5ee EburVwjosYb+qI7Es/DtpzChPo1y5H4A06uVY9y5xiW6/Kkeyb4W9hsbr7EUdkirThn5 MWi94UyjaGwdtqCpr4XDCqtXhKWmW2LGp8AfIcMixC+b8yB6X+VP72Xg5aVJn+eunK3I c27lV4yBuEARiaPh6Xa5PbRSF3PTrhtAqIrMLSO4thjQrRFAhb32Eeik6KmOoFgdDr89 85ua9gocBcH8FjGIqQK7hNb+G7TYCuuExfYv1EGRrWScl0vpx1Wlbb6MI2TF1hpPiff3 XWaw== X-Gm-Message-State: AHPjjUj9bJEtTCnUxmN1+nhJvkblncG3xliMU62wLX8BDLnFxXg+OzGy EpE94GbvSlRWyJ2hls8zPthk/uq1XYc= X-Google-Smtp-Source: AOwi7QCsWbwbVr0eemv3tcaQWLmjvNRB+oCcrRAR5Ouepwi5z66gjMJabzhiWBxFghiiLSXtrqrPHQ== X-Received: by 10.84.143.165 with SMTP id 34mr3393170plz.91.1505947638274; Wed, 20 Sep 2017 15:47:18 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Sep 2017 15:47:17 -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 25/25] ubifs: switch to fscrypt_prepare_setattr() Date: Wed, 20 Sep 2017 15:46:05 -0700 Message-Id: <20170920224605.22030-26-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/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 */