From patchwork Mon Sep 12 19:29:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 9327817 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 A915C6089F for ; Mon, 12 Sep 2016 19:29:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BBFF28E93 for ; Mon, 12 Sep 2016 19:29:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9087B28E9B; Mon, 12 Sep 2016 19:29:38 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 35FDC28E93 for ; Mon, 12 Sep 2016 19:29:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757302AbcILT31 (ORCPT ); Mon, 12 Sep 2016 15:29:27 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35967 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756243AbcILT3Y (ORCPT ); Mon, 12 Sep 2016 15:29:24 -0400 Received: by mail-wm0-f41.google.com with SMTP id b187so152071897wme.1 for ; Mon, 12 Sep 2016 12:29:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bxakAmvXXIb9V7JNQoJyNSl2WZz/G4n6eIDb8pRSQBw=; b=DAqzYCLQ4O3xbJr8ojKrMPZp5sn0tpa9R4kmS96aAAvK+6wQcMYGSqaWYHas54Wj4L 8pTpAJBtF0p/EFbjyvaFaR0IzmTU+CHvRk7/DeURlutWi5L9suRBYaP0GxzVRxmnSttb tFFmi71WEDgG3imOfgAeO14lF1JfyevUf1n1jIN40RCYeEu5OwY7xmF9iWAjK4uHQnii TdwEBYSYnWhYqyLlr9UU3u/icdGnKIsAutGBnpwti3HsA4A0mzPKEZ17AxF2XCLz/j11 DHK0kM8ihdJgr+0GxLXxBe+40tKu4i/SLmzBbjt1EQgPi9XyLuFRmFWcbQQjRdUe4hNo qEjg== X-Gm-Message-State: AE9vXwP/1pEsLF+ZvLU6URydqOuRG/2Y46zfqc5HarKFu24z06/IeTd1LOUDlHk9F27+jpr8 X-Received: by 10.28.157.139 with SMTP id g133mr11723201wme.82.1473708562526; Mon, 12 Sep 2016 12:29:22 -0700 (PDT) Received: from veci.piliscsaba.szeredi.hu (pool-dsl-2c-0018.externet.hu. [217.173.44.24]) by smtp.gmail.com with ESMTPSA id f8sm19250418wjh.45.2016.09.12.12.29.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Sep 2016 12:29:21 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Al Viro Subject: [PATCH 01/17] bad_inode: add missing i_op initializers Date: Mon, 12 Sep 2016 21:29:03 +0200 Message-Id: <1473708559-12714-2-git-send-email-mszeredi@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1473708559-12714-1-git-send-email-mszeredi@redhat.com> References: <1473708559-12714-1-git-send-email-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP New inode operations were forgotten to be added to bad_inode. Most of the time the op is checked for NULL before being called but marking the inode bad and the check can race (very unlikely). However in case of ->get_link() only DCACHE_SYMLINK_TYPE is checked before calling the op, so there's no race and will definitely oops when trying to follow links on such a beast. Also remove comments about extinct ops. Signed-off-by: Miklos Szeredi Cc: --- fs/bad_inode.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/fs/bad_inode.c b/fs/bad_inode.c index 3ba385eaa26e..b8db8531e837 100644 --- a/fs/bad_inode.c +++ b/fs/bad_inode.c @@ -123,6 +123,50 @@ static int bad_inode_removexattr(struct dentry *dentry, const char *name) return -EIO; } +static const char *bad_inode_get_link(struct dentry *dentry, + struct inode *inode, + struct delayed_call *done) +{ + return ERR_PTR(-EIO); +} + +static struct posix_acl *bad_inode_get_acl(struct inode *inode, int type) +{ + return ERR_PTR(-EIO); +} + +static int bad_inode_fiemap(struct inode *inode, + struct fiemap_extent_info *fieinfo, u64 start, + u64 len) +{ + return -EIO; +} + +static int bad_inode_update_time(struct inode *inode, struct timespec *time, + int flags) +{ + return -EIO; +} + +static int bad_inode_atomic_open(struct inode *inode, struct dentry *dentry, + struct file *file, unsigned int open_flag, + umode_t create_mode, int *opened) +{ + return -EIO; +} + +static int bad_inode_tmpfile(struct inode *inode, struct dentry *dentry, + umode_t mode) +{ + return -EIO; +} + +static int bad_inode_set_acl(struct inode *inode, struct posix_acl *acl, + int type) +{ + return -EIO; +} + static const struct inode_operations bad_inode_ops = { .create = bad_inode_create, @@ -135,10 +179,6 @@ static const struct inode_operations bad_inode_ops = .mknod = bad_inode_mknod, .rename2 = bad_inode_rename2, .readlink = bad_inode_readlink, - /* follow_link must be no-op, otherwise unmounting this inode - won't work */ - /* put_link returns void */ - /* truncate returns void */ .permission = bad_inode_permission, .getattr = bad_inode_getattr, .setattr = bad_inode_setattr, @@ -146,6 +186,13 @@ static const struct inode_operations bad_inode_ops = .getxattr = bad_inode_getxattr, .listxattr = bad_inode_listxattr, .removexattr = bad_inode_removexattr, + .get_link = bad_inode_get_link, + .get_acl = bad_inode_get_acl, + .fiemap = bad_inode_fiemap, + .update_time = bad_inode_update_time, + .atomic_open = bad_inode_atomic_open, + .tmpfile = bad_inode_tmpfile, + .set_acl = bad_inode_set_acl, };