From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guenter Roeck Subject: [PATCH resend] ufs: Fix backtrace seen when mounting a bad ufs file system Date: Thu, 30 Jun 2011 10:43:36 -0700 Message-ID: <1309455816-8945-1-git-send-email-guenter.roeck@ericsson.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , Guenter Roeck To: Evgeniy Dushistov Return-path: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 --- Resend, this time copying the linux-fsdevel list. If I should send it to some other list, please let me know. 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