DragonFlyBSD Kernel Audit
DF-0663 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c
--- a/sys/netgraph/ng_device.c
+++ b/sys/netgraph/ng_device.c
@@ -286,14 +286,11 @@ ng_device_newhook(node_p node, hook_p hook, const char *name)
 	new_connection->ngddev = make_dev(&ngd_cdevsw,
 	    new_connection->unit, 0, 0, 0600, "ngd%d", new_connection->unit);
 	if(new_connection->ngddev == NULL) {
 		kprintf("%s(): make_dev failed\n", __func__);
-		SLIST_REMOVE(&sc->head, new_connection, ngd_connection, links);
 		kfree(new_connection, M_DEVBUF);
 		return(-1);
 	}
 
 	new_connection->readq =
 	    kmalloc(sizeof(char)*NGD_QUEUE_SIZE, M_DEVBUF, M_NOWAIT | M_ZERO);
 	if(new_connection->readq == NULL) {
 		kprintf("%s(): readq malloc failed\n", __func__);
 		destroy_dev(new_connection->ngddev);
-		SLIST_REMOVE(&sc->head, new_connection, ngd_connection, links);
 		kfree(new_connection, M_DEVBUF);
 		return(-1);
 	}
 
 	/* point to begin of buffer */
 	new_connection->loc = 0;
 	new_connection->active_hook = hook;
 
 	SLIST_INSERT_HEAD(&sc->head, new_connection, links);
 
 	return(0);
 }
 
/*
 * NOTE: this file (sys/netgraph/ng_device.c) is NOT registered in
 * sys/conf/files and is therefore dead code on all standard DragonFly
 * kernel builds. Only sys/netgraph7/ng_device.c (a complete rewrite
 * without this bug) is built. Recommend deleting this dead file.
 */