Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754434Ab1FZRpQ (ORCPT ); Sun, 26 Jun 2011 13:45:16 -0400 Received: from imr4.ericy.com ([198.24.6.8]:34704 "EHLO imr4.ericy.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753498Ab1FZRnq (ORCPT ); Sun, 26 Jun 2011 13:43:46 -0400 From: Guenter Roeck To: Evgeniy Dushistov CC: , Guenter Roeck Subject: [PATCH] ufs: Fix backtrace seen when mounting a bad ufs file system Date: Sun, 26 Jun 2011 10:43:25 -0700 Message-ID: <1309110205-26433-1-git-send-email-guenter.roeck@ericsson.com> X-Mailer: git-send-email 1.7.3.1 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1866 Lines: 56 If an attempt is made to mount a bad ufs file system, the following backtrace may be seen. Call Trace: [] mutex_lock+0x18/0x70 [] ufs_sync_fs+0x2c/0x278 [] __sync_filesystem+0x74/0xb8 [] sync_filesystem+0x4c/0x80 [] generic_shutdown_super+0x34/0x110 [] kill_block_super+0x24/0x80 [] deactivate_locked_super+0x6c/0x98 [] mount_bdev+0x218/0x220 [] mount_fs+0xe4/0x220 [] vfs_kern_mount+0x64/0x110 [] do_kern_mount+0x4c/0x138 [] do_mount+0x440/0x898 [] compat_sys_mount+0xd8/0x248 The backtrace occurs if ufs_read_cylinder_structures() reports an error. The calling function ufs_fill_super() tries to clean up, but does not return the error to the calling code. This ultimately causes the backtrace. Fix problem by returning an error from ufs_fill_super() if ufs_read_cylinder_structures() fails. Signed-off-by: Guenter Roeck --- fs/ufs/super.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 3915ade..c398221 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c @@ -1174,8 +1174,12 @@ magic_found: * Read cylinder group structures */ if (!(sb->s_flags & MS_RDONLY)) - if (!ufs_read_cylinder_structures(sb)) + if (!ufs_read_cylinder_structures(sb)) { + dput(sb->s_root); + sb->s_root = NULL; + ret = -ENODEV; goto failed; + } UFSD("EXIT\n"); return 0; -- 1.7.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/