From owner-freebsd-current@FreeBSD.ORG Tue Dec 7 14:34:02 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0745516A4CE for ; Tue, 7 Dec 2004 14:34:02 +0000 (GMT) Received: from peedub.jennejohn.org (Jb2f0.j.pppool.de [85.74.178.240]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3784A43D6A for ; Tue, 7 Dec 2004 14:34:01 +0000 (GMT) (envelope-from garyj@jennejohn.org) Received: from jennejohn.org (localhost [127.0.0.1]) by peedub.jennejohn.org (8.13.1/8.11.6) with ESMTP id iB7EXxXQ000829 for ; Tue, 7 Dec 2004 15:33:59 +0100 (CET) (envelope-from garyj@jennejohn.org) Message-Id: <200412071433.iB7EXxXQ000829@peedub.jennejohn.org> X-Mailer: exmh version 2.7.0 06/18/2004 with nmh-1.0.4 To: freebsd-current@freebsd.org From: Gary Jennejohn Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary="==_Exmh_-12333322120" Date: Tue, 07 Dec 2004 15:33:59 +0100 Sender: garyj@jennejohn.org Subject: NTFS after phk's changes X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Dec 2004 14:34:02 -0000 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--