diff options
author | green <green@FreeBSD.org> | 1999-08-24 05:58:35 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 1999-08-24 05:58:35 +0000 |
commit | a788068fedc532983e4f96648cdc0d5a8be33a2d (patch) | |
tree | 239cfb1180dad835b227e712870934f75f06eebf /sys/vm | |
parent | 06ec3ed8b8c82cc10eda433e7d4a96bfe3146fd2 (diff) | |
download | FreeBSD-src-a788068fedc532983e4f96648cdc0d5a8be33a2d.zip FreeBSD-src-a788068fedc532983e4f96648cdc0d5a8be33a2d.tar.gz |
When the SYSINIT() was removed, it was replaced with a make_dev on-demand
creation of /dev/drum via calling swapon. However, the make_dev has a
bogus (insofar that it hasn't been added yet) cdevsw, so later we end
up crashing with a null pointer dereference on the swap vp's specinfo.
The specinfo points to a dev_t with a major of 254 (uninitialized), and
we get a crash on its d_strategy being called.
The simple solution to this is to call cdevsw_add before the make_dev
is ever used. This fixes the panic which occurred upon swapping.
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_swap.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index 4f7592c..e6337bb 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)vm_swap.c 8.5 (Berkeley) 2/17/94 - * $Id: vm_swap.c,v 1.81 1999/08/13 10:29:38 phk Exp $ + * $Id: vm_swap.c,v 1.82 1999/08/23 20:59:21 phk Exp $ */ #include "opt_swap.h" @@ -205,6 +205,7 @@ swapon(p, uap) static int once; if (!once) { + cdevsw_add(&sw_cdevsw); make_dev(&sw_cdevsw, 0, UID_ROOT, GID_KMEM, 0640, "drum"); once++; } |