From owner-freebsd-bugs@FreeBSD.ORG Tue Nov 13 09:10:02 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D19D16A41B for ; Tue, 13 Nov 2007 09:10:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 6C02913C4B7 for ; Tue, 13 Nov 2007 09:10:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id lAD9A2Oj066872 for ; Tue, 13 Nov 2007 09:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id lAD9A2Vv066871; Tue, 13 Nov 2007 09:10:02 GMT (envelope-from gnats) Resent-Date: Tue, 13 Nov 2007 09:10:02 GMT Resent-Message-Id: <200711130910.lAD9A2Vv066871@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ighighi Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3C9916A419 for ; Tue, 13 Nov 2007 09:01:59 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id E1F2F13C4B9 for ; Tue, 13 Nov 2007 09:01:59 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.1/8.14.1) with ESMTP id lAD91Vos028592 for ; Tue, 13 Nov 2007 09:01:31 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.1/8.14.1/Submit) id lAD91V1R028591; Tue, 13 Nov 2007 09:01:31 GMT (envelope-from nobody) Message-Id: <200711130901.lAD91V1R028591@www.freebsd.org> Date: Tue, 13 Nov 2007 09:01:31 GMT From: Ighighi To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/118017: [patch]: Memory leak in NTFS when unloading module X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2007 09:10:02 -0000 >Number: 118017 >Category: kern >Synopsis: [patch]: Memory leak in NTFS when unloading module >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Nov 13 09:10:02 UTC 2007 >Closed-Date: >Last-Modified: >Originator: Ighighi >Release: 6.3-PRERELEASE (RELENG_6) >Organization: >Environment: FreeBSD orion 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #0: Mon Nov 12 08:12:36 VET 2007 root@orion:/usr/obj/usr/src/sys/CUSTOM i386 >Description: 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. >How-To-Repeat: /sbin/umount -v -t ntfs -a /sbin/kldunload -v ntfs.ko grep nthash /var/log/messages >Fix: 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() void ntfs_nthashdestroy(void) { + hashdestroy(ntfs_nthashtbl, M_NTFSNTHASH, ntfs_nthash); lockdestroy(&ntfs_hashlock); mtx_destroy(&ntfs_nthash_mtx); } >Release-Note: >Audit-Trail: >Unformatted: