Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Dec 2004 15:33:59 +0100
From:      Gary Jennejohn <garyj@jennejohn.org>
To:        freebsd-current@freebsd.org
Subject:   NTFS after phk's changes
Message-ID:  <200412071433.iB7EXxXQ000829@peedub.jennejohn.org>

next in thread | raw e-mail | index | archive | help
This is a multipart MIME message.

--==_Exmh_-12333322120
Content-Type: text/plain; charset=us-ascii

NTFS is unusable after phk's changes. Mounting an NTFS file system
results in a panic.

Line 336 in /sys/fs/ntfs/ntfs_vfsops.c is the culprit:

	ntfs_u28_init(ntmp, NULL, cs_local, cs_ntfs);

Passing NULL causes the panic because ntfs_u28_init() dereferences the
pointer without checking whether it's NULL.

With the (hopefully) attached patch I can at least mount and ls a
NTFS file system, which is about all that could be done prior to phk's
modifications.

The handling of (p == NULL) in ntfs_u28() is questionable, but it works
for my test case.

--------
Gary Jennejohn / garyj[at]jennejohn.org gj[at]freebsd.org garyj[at]denx.de


--==_Exmh_-12333322120
Content-Type: text/plain ; name="ntfs_subr.diff"; charset=us-ascii
Content-Description: ntfs_subr.diff

--- /sys/fs/ntfs/ntfs_subr.c.orig	Tue Dec  7 13:17:33 2004
+++ /sys/fs/ntfs/ntfs_subr.c	Tue Dec  7 13:17:10 2004
@@ -2049,6 +2049,10 @@
 		return (0);
 	}
 
+	/* prevent a panic */
+	if (u2w == NULL)
+		return (0);
+
 	MALLOC(u28, char **, 256 * sizeof(char*), M_TEMP, M_WAITOK | M_ZERO);
 
 	for (i=0; i<256; i++) {
--- /sys/fs/ntfs/ntfs_subr.c.orig	Tue Dec  7 13:46:54 2004
+++ /sys/fs/ntfs/ntfs_subr.c	Tue Dec  7 14:59:06 2004
@@ -2168,9 +2168,10 @@
 		return ('?');
 	}
 
-	p = ntmp->ntm_u28[(wc>>8)&0xFF];
+	/* prevent a panic */
+	p = ntmp->ntm_u28?ntmp->ntm_u28[(wc>>8)&0xFF]:NULL;
 	if (p == NULL)
-		return ('_');
+		return (wc);
 	return (p[wc&0xFF]&0xFF);
 }
 

--==_Exmh_-12333322120--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412071433.iB7EXxXQ000829>