summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2011-04-04 11:29:40 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2011-04-04 11:29:40 +0000
commit551b5ebdf3c16dfa2e37a399be401f73114fffac (patch)
treee9152f6bdbcbfb3a4d297203ef42f528b1b340b7
parent8270791b223e4865ca45ed0b630cf5877b1512f1 (diff)
Disallow swapping to vnd's and return ENOTSUPP back
to userland. Wrap the checking code in #if NVND > 0 as pointed out by miod. ok beck@ ok deraadt@, krw@ (on an earlier diff)
-rw-r--r--sys/uvm/uvm_swap.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c
index 3a93811ea88..036c8255dc7 100644
--- a/sys/uvm/uvm_swap.c
+++ b/sys/uvm/uvm_swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_swap.c,v 1.100 2010/12/21 20:14:44 thib Exp $ */
+/* $OpenBSD: uvm_swap.c,v 1.101 2011/04/04 11:29:39 thib Exp $ */
/* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */
/*
@@ -59,6 +59,8 @@
#include <miscfs/specfs/specdev.h>
+#include "vnd.h"
+
/*
* uvm_swap.c: manage configuration and i/o to swap space.
*/
@@ -912,6 +914,12 @@ swap_on(struct proc *p, struct swapdev *sdp)
vp = sdp->swd_vp;
dev = sdp->swd_dev;
+#if NVND > 0
+ /* no swapping to vnds. */
+ if (bdevsw[major(dev)].d_strategy == vndstrategy)
+ return (EOPNOTSUPP);
+#endif
+
/*
* open the swap file (mostly useful for block device files to
* let device driver know what is up).