Commit 4c3c3a21 authored by Ben Collins's avatar Ben Collins Committed by Linus Torvalds

[PATCH] Fix compat_ioctl

This fixes the compat_ioctl interface for the case where a NULL handler
is registered. This should produce a "compatible" as opposed to
"translated" interface for the specified ioctl. The patch was sent to
linux-kernel and no one complained (atleast with this second rev).
parent e515904b
......@@ -300,7 +300,6 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, unsigned lon
{
struct file * filp;
int error = -EBADF;
int (*handler)(unsigned int, unsigned int, unsigned long, struct file * filp);
struct ioctl_trans *t;
filp = fget(fd);
......@@ -317,8 +316,10 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, unsigned lon
while (t && t->cmd != cmd)
t = (struct ioctl_trans *)t->next;
if (t) {
handler = t->handler;
error = handler(fd, cmd, arg, filp);
if (t->handler)
error = t->handler(fd, cmd, arg, filp);
else
error = sys_ioctl(fd, cmd, arg);
} else if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
error = siocdevprivate_ioctl(fd, cmd, arg);
} else {
......
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