patch-2.4.7 linux/drivers/char/drm/i810_dma.c

Next file: linux/drivers/char/drm/ioctl.c
Previous file: linux/drivers/char/drm/i810_bufs.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.6/linux/drivers/char/drm/i810_dma.c linux/drivers/char/drm/i810_dma.c
@@ -1416,6 +1416,11 @@
    	buf_priv = buf->dev_private;
 	if (buf_priv->currently_mapped != I810_BUF_MAPPED) return -EPERM;
 
+	/* Stopping end users copying their data to the entire kernel
+	   is good.. */
+	if (d.used < 0 || d.used > buf->total)
+		return -EINVAL;
+		
    	if (copy_from_user(buf_priv->virtual, d.address, d.used))
 		return -EFAULT;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)