Commit 50e4706d authored by Tim Waugh's avatar Tim Waugh Committed by Linus Torvalds

[PATCH] 2.5.3-pre6: getmodes

This patch prevents ppdev from oopsing when the PPGETMODES ioctl is
used before a PPCLAIM.

	* drivers/char/ppdev.c: Fix an oops in PPGETMODES handling.
parent 77093e9a
......@@ -429,8 +429,12 @@ static int pp_ioctl(struct inode *inode, struct file *file,
{
unsigned int modes;
modes = pp->pdev->port->modes;
if (copy_to_user ((unsigned int *)arg, &modes, sizeof (port->modes))) {
port = parport_find_number (minor);
if (!port)
return -ENODEV;
modes = port->modes;
if (copy_to_user ((unsigned int *)arg, &modes, sizeof (modes))) {
return -EFAULT;
}
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment