Date: Fri, 18 Feb 2005 18:24:36 +0100 (CET) From: Antoine Brodin <antoine.brodin@laposte.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/77685: Little memory leak in devfs Message-ID: <200502181724.j1IHOaU9001182@barton.dreadbsd.org> Resent-Message-ID: <200502181730.j1IHUHB6096442@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 77685 >Category: kern >Synopsis: Little memory leak in devfs >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Feb 18 17:30:16 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Antoine Brodin >Release: FreeBSD 6.0-CURRENT i386 >Organization: None >Environment: System: FreeBSD barton.dreadbsd.org 6.0-CURRENT FreeBSD 6.0-CURRENT #1: Fri Feb 18 17:40:26 CET 2005 antoine@barton.dreadbsd.org:/usr/obj/usr/src/sys/BARTON i386 >Description: There's a little leak in devfs: when destroying a device created by make_dev_alias, the symlink is leaked. When using MAC, the MAC label is probably leaked too but I don't use MAC so somebody who uses MAC should test it. >How-To-Repeat: The is an easy way to reproduce and to see this leak: celeron# vmstat -m | grep DEVFS DEVFS 136 20K 20K 245 16,32,128,4096 celeron# ifconfig lo1 create celeron# ls /dev celeron# vmstat -m | grep DEVFS DEVFS 139 20K 20K 248 16,32,128,4096 celeron# ifconfig lo1 destroy celeron# ls /dev celeron# vmstat -m | grep DEVFS DEVFS 137 20K 20K 248 16,32,128,4096 On a patched box: barton# vmstat -m | grep DEVFS DEVFS 162 23K 23K 166 16,32,128,4096 barton# ifconfig lo1 create barton# ls /dev barton# vmstat -m | grep DEVFS DEVFS 165 23K 23K 169 16,32,128,4096 barton# ifconfig lo1 destroy barton# ls /dev barton# vmstat -m | grep DEVFS DEVFS 162 23K 23K 169 16,32,128,4096 >Fix: Apply the attached patch, the MAC part is untested. --- devfs_devs.diff begins here --- Index: devfs_devs.c =================================================================== RCS file: /home/ncvs/src/sys/fs/devfs/devfs_devs.c,v retrieving revision 1.33 diff -u -p -r1.33 devfs_devs.c --- devfs_devs.c 10 Feb 2005 12:22:17 -0000 1.33 +++ devfs_devs.c 18 Feb 2005 16:53:59 -0000 @@ -270,10 +270,7 @@ devfs_populate(struct devfs_mount *dm) if (dev == NULL && de != NULL) { dd = de->de_dir; *dep = NULL; - TAILQ_REMOVE(&dd->de_dlist, de, de_list); - if (de->de_vnode) - de->de_vnode->v_data = NULL; - FREE(de, M_DEVFS); + devfs_delete(dd, de); devfs_dropref(i); continue; } --- devfs_devs.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502181724.j1IHOaU9001182>