[PATCH] JFS oops fix

Linux Kernel Mailing List <[email protected]> Thu, 19 May 2005 13:08:19 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1521, 2005/05/19 10:08:19-03:00, [email protected]

	[PATCH] JFS oops fix
	
	Specifically, the kernel attempts to mount root with JFS first, and upon
	aborting jfs_read_super(), the value of sbi->nls_tab is -1, a non-NULL
	value that causes unload_nls() to be called on garbage data leading to a
	NULL pointer dereference.
	
	Author: Mike Kasick <[email protected]>
	Signed-off-by: Dave Kleikamp <[email protected]>



 super.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Nru a/fs/jfs/super.c b/fs/jfs/super.c
--- a/fs/jfs/super.c	2005-05-20 10:04:50 -07:00
+++ b/fs/jfs/super.c	2005-05-20 10:04:50 -07:00
@@ -407,7 +407,7 @@
 		jfs_err("jfs_umount failed with return code %d", rc);
 	}
 out_kfree:
-	if (sbi->nls_tab)
+	if (sbi->nls_tab && sbi->nls_tab != (void *) -1)
 		unload_nls(sbi->nls_tab);
 	kfree(sbi);
 	return NULL;