diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2011-04-04 11:29:40 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2011-04-04 11:29:40 +0000 |
commit | 551b5ebdf3c16dfa2e37a399be401f73114fffac (patch) | |
tree | e9152f6bdbcbfb3a4d297203ef42f528b1b340b7 /sys/uvm/uvm_swap.c | |
parent | 8270791b223e4865ca45ed0b630cf5877b1512f1 (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)
Diffstat (limited to 'sys/uvm/uvm_swap.c')
-rw-r--r-- | sys/uvm/uvm_swap.c | 10 |
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). |