kern/118017: [patch]: Memory leak in NTFS when unloading module

Ighighi ighighi at
Tue Nov 13 01:10:02 PST 2007

>Number:         118017
>Category:       kern
>Synopsis:       [patch]: Memory leak in NTFS when unloading module
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 13 09:10:02 UTC 2007
>Originator:     Ighighi
>Release:        6.3-PRERELEASE (RELENG_6)
FreeBSD orion 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #0: Mon Nov 12 08:12:36 VET 2007     root at orion:/usr/obj/usr/src/sys/CUSTOM  i386
When unloading ntfs.ko with kldunload(8), the following message appears in syslog:

"Warning: memory type NTFS nthash leaked memory on destroy (1 allocations, 65536 bytes leaked)."

The bug is in src/sys/fs/ntfs/ntfs_ihash.c
ntfs_nthashdestroy() is supposed to call hashdestroy(9) on ntfs_nthashtbl since
the latter was allocated with hashinit(9).

I've seen this message since 6.1.  By looking at the sources for -CURRENT and
RELENG_7, it seems to me that they also contain this bug.
/sbin/umount -v -t ntfs -a
/sbin/kldunload -v ntfs.ko
grep nthash /var/log/messages
The attached patch was successfully built and tested on FreeBSD 6.3-PRERELEASE.

Patch attached with submission follows:

--- src/sys/fs/ntfs/ntfs_ihash.c.orig	2005-01-06 14:10:39.000000000 -0400
+++ src/sys/fs/ntfs/ntfs_ihash.c	2007-11-13 03:59:58.252339682 -0400
@@ -73,6 +73,7 @@ ntfs_nthashinit()
+	hashdestroy(ntfs_nthashtbl, M_NTFSNTHASH, ntfs_nthash);


More information about the freebsd-bugs mailing list