dev/random duplicate call to destroy_dev

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Thu, 12 Feb 2004 20:32:52 +0000 (UTC)
Hi,

when unloading random module destry_dev also gets called for dev_t
aquired with make_dev_alias which is wrong according to make_dev(9).

Seems this has been living in there for 3y7m now ...
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/random/randomdev.c.diff?r1=1.3&r2=1.4

possible yet untested fix:

--- sys/dev/random/randomdev.c.orig	Thu Feb 12 20:12:58 2004
+++ sys/dev/random/randomdev.c	Thu Feb 12 20:25:26 2004
_at__at_ -104,7 +104,6 _at__at_ static struct proc *random_kthread_proc;

 /* For use with make_dev(9)/destroy_dev(9). */
 static dev_t	random_dev;
-static dev_t	urandom_dev;

 /* ARGSUSED */
 static int
_at__at_ -266,7 +265,7 _at__at_ random_modevent(module_t mod __unused, i
 			printf("random: <entropy source>\n");
 		random_dev = make_dev(&random_cdevsw, RANDOM_MINOR, UID_ROOT,
 			GID_WHEEL, 0666, "random");
-		urandom_dev = make_dev_alias(random_dev, "urandom");
+		(void)make_dev_alias(random_dev, "urandom");

 		/* Start the hash/reseed thread */
 		error = kthread_create(random_kthread, NULL,
_at__at_ -309,7 +308,6 _at__at_ random_modevent(module_t mod __unused, i
 		random_deinit();

 		destroy_dev(random_dev);
-		destroy_dev(urandom_dev);
 		return 0;

 	case MOD_SHUTDOWN:

-- 
Bjoern A. Zeeb				bzeeb at Zabbadoz dot NeT
56 69 73 69 74				http://www.zabbadoz.net/
Received on Thu Feb 12 2004 - 11:33:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:42 UTC