From patchwork Thu Dec 7 08:37:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khalid Elmously X-Patchwork-Id: 845464 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3yspmH65Flz9s84; Thu, 7 Dec 2017 19:38:39 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1eMrhU-0005Jl-BK; Thu, 07 Dec 2017 08:38:36 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1eMrhF-0005DV-AK for kernel-team@lists.ubuntu.com; Thu, 07 Dec 2017 08:38:21 +0000 Received: from mail-it0-f72.google.com ([209.85.214.72]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1eMrhF-0006xh-05 for kernel-team@lists.ubuntu.com; Thu, 07 Dec 2017 08:38:21 +0000 Received: by mail-it0-f72.google.com with SMTP id z142so9643106itc.6 for ; Thu, 07 Dec 2017 00:38:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=20l6Gq9Yb24KHo1IjLwtTrnPvKKBS6Vjo3cjeiSwj3U=; b=ijZ2zY8PMt9IxubJ3Xxxx0q9VeWhVGmQeN88P5b1PxvBOmimdNuSUiNV4k0KNVT+xT Wco1kru8RmgXYVgB3WLlbPr30xD3llfz5IQihOGrfvElUcsU/9Gpk5V4n5l3XsgNLKah kp41RxYT1yEpUvNArc7xlY+kPY84wHB3ol3z9s6w/F0xjX7BYOCPCe1O8Mu3wEyS5XeT sQVDRV42GcldrhQqxbikpaocbBWsED/U9PTPSQU49UR67N0wadbonLgOOueC0f/KHrCf MZQcbAv8xm0LcquJNaHl5kTCTKypTFbfhCzr0FlMtsRSapX6gNam+2HvS+Jf+UNG+uuO a4YA== X-Gm-Message-State: AKGB3mLx/wTnk/IP6g2owqaDFF7ygqlagkhlrSO+AWa2BTRZym8rBuMR L/+XY2uJlzhhbBbHNnzyXzIkHBSWL9nSNBLI89n0+WgWYp8Sn+5gZ64/XpE/KKoUMig0ynNbHad zQxJsBfYwMIW2b/ERSRwvK1q4ACSx509yAXdNWl8Tyg== X-Received: by 10.36.172.81 with SMTP id m17mr435411iti.151.1512635899499; Thu, 07 Dec 2017 00:38:19 -0800 (PST) X-Google-Smtp-Source: AGs4zMbzT5uNokP/jqFMF2WbTNT3jYUvIkckpXv8K3tcTF4V99ke4lPibwnHXSC2GCoQEC33R81jxA== X-Received: by 10.36.172.81 with SMTP id m17mr435401iti.151.1512635899268; Thu, 07 Dec 2017 00:38:19 -0800 (PST) Received: from kbuntu.fuzzbuzz.org (198-84-180-157.cpe.teksavvy.com. [198.84.180.157]) by smtp.gmail.com with ESMTPSA id i203sm2551981itb.40.2017.12.07.00.38.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Dec 2017 00:38:18 -0800 (PST) From: Khalid Elmously To: kernel-team@lists.ubuntu.com Subject: [Xenial][PATCH 7/9] fuse: Propagate dentry down to inode_change_ok() Date: Thu, 7 Dec 2017 03:37:55 -0500 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: http://bugs.launchpad.net/bugs/1415636 commit 62490330769c1ce5dcba3f1f3e8f4005e9b797e6 upstream. To avoid clearing of capabilities or security related extended attributes too early, inode_change_ok() will need to take dentry instead of inode. Propagate it down to fuse_do_setattr(). Acked-by: Miklos Szeredi Reviewed-by: Christoph Hellwig Signed-off-by: Jan Kara Signed-off-by: Khalid Elmously --- fs/fuse/dir.c | 5 +++-- fs/fuse/file.c | 2 +- fs/fuse/fuse_i.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index bf76591c3dd7..43a74c1f83dc 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1589,9 +1589,10 @@ int fuse_flush_times(struct inode *inode, struct fuse_file *ff) * vmtruncate() doesn't allow for this case, so do the rlimit checking * and the actual truncation by hand. */ -int fuse_do_setattr(struct inode *inode, struct iattr *attr, +int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, struct file *file) { + struct inode *inode = d_inode(dentry); struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_inode *fi = get_fuse_inode(inode); FUSE_ARGS(args); @@ -1733,7 +1734,7 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr) if (!attr->ia_valid) return 0; - ret = fuse_do_setattr(inode, attr, file); + ret = fuse_do_setattr(entry, attr, file); if (!ret) { /* Directory mode changed, may need to revalidate access */ if (d_is_dir(entry) && (attr->ia_valid & ATTR_MODE)) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index b00bc25d7c90..9fbf4a86147c 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2816,7 +2816,7 @@ static void fuse_do_truncate(struct file *file) attr.ia_file = file; attr.ia_valid |= ATTR_FILE; - fuse_do_setattr(inode, &attr, file); + fuse_do_setattr(file_dentry(file), &attr, file); } static inline loff_t fuse_round_up(loff_t off) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index d761934f7ec1..b8d3d35e1afe 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -956,7 +956,7 @@ bool fuse_write_update_size(struct inode *inode, loff_t pos); int fuse_flush_times(struct inode *inode, struct fuse_file *ff); int fuse_write_inode(struct inode *inode, struct writeback_control *wbc); -int fuse_do_setattr(struct inode *inode, struct iattr *attr, +int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, struct file *file); void fuse_set_initialized(struct fuse_conn *fc);