diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index e8d50af..4501b4b 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -506,6 +506,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
 	vma->vm_ops = &drm_vm_dma_ops;
 
 	vma->vm_flags |= VM_RESERVED;	/* Don't swap */
+	vma->vm_flags |= VM_DONTEXPAND;
 
 	vma->vm_file = filp;	/* Needed for drm_vm_open() */
 	drm_vm_open_locked(vma);
@@ -655,12 +656,26 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
 		return -EINVAL;	/* This should never happen. */
 	}
 	vma->vm_flags |= VM_RESERVED;	/* Don't swap */
+	vma->vm_flags |= VM_DONTEXPAND;
 
 	vma->vm_file = filp;	/* Needed for drm_vm_open() */
 	drm_vm_open_locked(vma);
 	return 0;
 }
 
+#include <ksplice-patch.h>
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops);
+
+void ksplice_dontexpand_drm(void)
+{
+	ksplice_dontexpand(&drm_vm_ops);
+	ksplice_dontexpand(&drm_vm_shm_ops);
+	ksplice_dontexpand(&drm_vm_dma_ops);
+	ksplice_dontexpand(&drm_vm_sg_ops);
+}
+ksplice_apply(ksplice_dontexpand_drm);
+
 int drm_mmap(struct file *filp, struct vm_area_struct *vma)
 {
 	struct drm_file *priv = filp->private_data;
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c
index 82f2e27..2543588 100644
--- a/drivers/char/mspec.c
+++ b/drivers/char/mspec.c
@@ -283,7 +283,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
 	vdata->refcnt = ATOMIC_INIT(1);
 	vma->vm_private_data = vdata;
 
-	vma->vm_flags |= (VM_IO | VM_RESERVED | VM_PFNMAP);
+	vma->vm_flags |= (VM_IO | VM_RESERVED | VM_PFNMAP | VM_DONTEXPAND);
 	if (vdata->type == MSPEC_FETCHOP || vdata->type == MSPEC_UNCACHED)
 		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 	vma->vm_ops = &mspec_vm_ops;
@@ -291,6 +291,16 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
 	return 0;
 }
 
+#include <ksplice-patch.h>
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops);
+
+void ksplice_dontexpand_mspec(void)
+{
+	ksplice_dontexpand(&mspec_vm_ops);
+}
+ksplice_apply(ksplice_dontexpand_mspec);
+
 static int
 fetchop_mmap(struct file *file, struct vm_area_struct *vma)
 {
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c
index a94473d..5d8dcb9 100644
--- a/fs/ncpfs/mmap.c
+++ b/fs/ncpfs/mmap.c
@@ -50,10 +50,6 @@ static int ncp_file_mmap_fault(struct vm_area_struct *area,
 	pos = vmf->pgoff << PAGE_SHIFT;
 
 	count = PAGE_SIZE;
-	if ((unsigned long)vmf->virtual_address + PAGE_SIZE > area->vm_end) {
-		WARN_ON(1); /* shouldn't happen? */
-		count = area->vm_end - (unsigned long)vmf->virtual_address;
-	}
 	/* what we can read in one go */
 	bufsize = NCP_SERVER(inode)->buffer_size;
 
diff --git a/kernel/relay.c b/kernel/relay.c
index 61134eb..7deab30 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -92,12 +92,23 @@ static int relay_mmap_buf(struct rchan_buf *buf, struct vm_area_struct *vma)
 		return -EINVAL;
 
 	vma->vm_ops = &relay_file_mmap_ops;
+	vma->vm_flags |= VM_DONTEXPAND;
 	vma->vm_private_data = buf;
 	buf->chan->cb->buf_mapped(buf, filp);
 
 	return 0;
 }
 
+#include <ksplice-patch.h>
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops);
+
+void ksplice_dontexpand_relay(void)
+{
+	ksplice_dontexpand(&relay_file_mmap_ops);
+}
+ksplice_apply(ksplice_dontexpand_relay);
+
 /**
  *	relay_alloc_buf - allocate a channel buffer
  *	@buf: the buffer struct
diff --git a/mm/mmap.c b/mm/mmap.c
index d2b6d44..3382c71 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2216,7 +2216,7 @@ int install_special_mapping(struct mm_struct *mm,
 	vma->vm_start = addr;
 	vma->vm_end = addr + len;
 
-	vma->vm_flags = vm_flags | mm->def_flags;
+	vma->vm_flags = vm_flags | mm->def_flags | VM_DONTEXPAND;
 	vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
 
 	vma->vm_ops = &special_mapping_vmops;
@@ -2231,3 +2231,40 @@ int install_special_mapping(struct mm_struct *mm,
 
 	return 0;
 }
+
+#include <ksplice-patch.h>
+
+int ksplice_mmap_check_apply(void)
+{
+	struct task_struct *g, *tsk;
+	do_each_thread(g, tsk) {
+		if (tsk->mm == NULL)
+			continue;
+		if (!down_write_trylock(&tsk->mm->mmap_sem))
+			return 1;
+		up_write(&tsk->mm->mmap_sem);
+	} while_each_thread(g, tsk);
+	return 0;
+}
+ksplice_check_apply(ksplice_mmap_check_apply);
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops)
+{
+	struct task_struct *g, *tsk;
+	do_each_thread(g, tsk) {
+		struct vm_area_struct *vma;
+		if (tsk->mm == NULL)
+			continue;
+		for (vma = tsk->mm->mmap; vma != NULL; vma = vma->vm_next) {
+			if (vma->vm_ops == vm_ops)
+				vma->vm_flags |= VM_DONTEXPAND;
+		}
+	} while_each_thread(g, tsk);
+}
+EXPORT_SYMBOL_GPL(ksplice_dontexpand);
+
+void ksplice_dontexpand_special(void)
+{
+	ksplice_dontexpand(&special_mapping_vmops);
+}
+ksplice_apply(ksplice_dontexpand_special);
diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c
index 5d3c037..f95aa09 100644
--- a/sound/oss/via82cxxx_audio.c
+++ b/sound/oss/via82cxxx_audio.c
@@ -2104,6 +2104,7 @@ static struct page * via_mm_nopage (struct vm_area_struct * vma,
 {
 	struct via_info *card = vma->vm_private_data;
 	struct via_channel *chan = &card->ch_out;
+	unsigned long max_bufs;
 	struct page *dmapage;
 	unsigned long pgoff;
 	int rd, wr;
@@ -2127,14 +2128,11 @@ static struct page * via_mm_nopage (struct vm_area_struct * vma,
 	rd = card->ch_in.is_mapped;
 	wr = card->ch_out.is_mapped;
 
-#ifndef VIA_NDEBUG
-	{
-	unsigned long max_bufs = chan->frag_number;
-	if (rd && wr) max_bufs *= 2;
-	/* via_dsp_mmap() should ensure this */
-	assert (pgoff < max_bufs);
-	}
-#endif
+	max_bufs = chan->frag_number;
+	if (rd && wr)
+		max_bufs *= 2;
+	if (pgoff >= max_bufs)
+		return NOPAGE_SIGBUS;
 
 	/* if full-duplex (read+write) and we have two sets of bufs,
 	 * then the playback buffers come first, sez soundcard.c */
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index 6495534..3b6b5f9 100644
--- a/sound/usb/usx2y/usX2Yhwdep.c
+++ b/sound/usb/usx2y/usX2Yhwdep.c
@@ -84,11 +84,21 @@ static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct v
 		us428->us428ctls_sharedmem->CtlSnapShotLast = -2;
 	}
 	area->vm_ops = &us428ctls_vm_ops;
-	area->vm_flags |= VM_RESERVED;
+	area->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
 	area->vm_private_data = hw->private_data;
 	return 0;
 }
 
+#include <ksplice-patch.h>
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops);
+
+void ksplice_dontexpand_us428ctls(void)
+{
+	ksplice_dontexpand(&us428ctls_vm_ops);
+}
+ksplice_apply(ksplice_dontexpand_us428ctls);
+
 static unsigned int snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file, poll_table *wait)
 {
 	unsigned int	mask = 0;
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index 800b5ce..e11ce41 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -722,11 +722,21 @@ static int snd_usX2Y_hwdep_pcm_mmap(struct snd_hwdep * hw, struct file *filp, st
 		return -ENODEV;
 	}
 	area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops;
-	area->vm_flags |= VM_RESERVED;
+	area->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
 	area->vm_private_data = hw->private_data;
 	return 0;
 }
 
+#include <ksplice-patch.h>
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops);
+
+void ksplice_dontexpand_usX2Y_hwdep_pcm(void)
+{
+	ksplice_dontexpand(&snd_usX2Y_hwdep_pcm_vm_ops);
+}
+ksplice_apply(ksplice_dontexpand_usX2Y_hwdep_pcm);
+
 
 static void snd_usX2Y_hwdep_pcm_private_free(struct snd_hwdep *hwdep)
 {

