From patchwork Wed May 30 10:39:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 161933 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 34FF5B7062 for ; Wed, 30 May 2012 20:45:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752416Ab2E3Kpy (ORCPT ); Wed, 30 May 2012 06:45:54 -0400 Received: from natasha.panasas.com ([67.152.220.90]:58570 "EHLO natasha.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752246Ab2E3Kpx (ORCPT ); Wed, 30 May 2012 06:45:53 -0400 Received: from zenyatta.panasas.com (zenyatta.int.panasas.com [172.17.28.63]) by natasha.panasas.com (8.13.1/8.13.1) with ESMTP id q4UAdOaw019164; Wed, 30 May 2012 06:39:25 -0400 Received: from office.bharrosh.com (172.17.142.174) by zenyatta.int.panasas.com (172.17.28.63) with Microsoft SMTP Server (TLS) id 14.1.355.2; Wed, 30 May 2012 06:39:17 -0400 Message-ID: <4FC5F8CC.20400@panasas.com> Date: Wed, 30 May 2012 13:39:08 +0300 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111113 Thunderbird/8.0 MIME-Version: 1.0 To: Jan Kara CC: Al Viro , Ted Tso , , Subject: [PATCH 5/4] exofs: Handle error from d_splice_alias() References: <1338322067-17566-1-git-send-email-jack@suse.cz> In-Reply-To: <1338322067-17566-1-git-send-email-jack@suse.cz> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org When directory hierarchy is corrupted and contains cycles, d_splice_alias() can fail. Handle the failure cleanly. Identical/coppied from: ext2: Handle error from d_splice_alias() Signed-off-by: Jan Kara [exofs is just yet another copy/paste of ext2 code] Signed-off-by: Boaz Harrosh --- fs/exofs/namei.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c index fc7161d..82de452 100644 --- a/fs/exofs/namei.c +++ b/fs/exofs/namei.c @@ -50,13 +50,19 @@ static struct dentry *exofs_lookup(struct inode *dir, struct dentry *dentry, { struct inode *inode; ino_t ino; + struct dentry *ret; if (dentry->d_name.len > EXOFS_NAME_LEN) return ERR_PTR(-ENAMETOOLONG); ino = exofs_inode_by_name(dir, dentry); inode = ino ? exofs_iget(dir->i_sb, ino) : NULL; - return d_splice_alias(inode, dentry); + ret = d_splice_alias(inode, dentry); + if (IS_ERR(ret)) { + EXOFS_ERR("directory #%lu corrupted", dir->i_ino); + iput(inode); + } + return ret; } static int exofs_create(struct inode *dir, struct dentry *dentry, umode_t mode,