Skip to content

Commit

Permalink
Input: do not corrupt system-wide procfs fops.
Browse files Browse the repository at this point in the history
entry->proc_fops is a pointer to struct file_operations. When we
call create_proc_entry(...), it pointis to proc_file_operations,
deep in fs/proc/generic.c. By adding a 'poll' member to this struct
we effectively force the 'poll' member on every file in /proc,
which is wrong (they all fail select(...) calls).

This patch changes a copy of entry->proc_fops and reassigns it rather
than changing the original member.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Luke Kosewski authored and Dmitry Torokhov committed Jun 1, 2005
1 parent b6cbf3e commit e334016
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,8 @@ static int input_handlers_read(char *buf, char **start, off_t pos, int count, in
return (count > cnt) ? cnt : count;
}

static struct file_operations input_fileops;

static int __init input_proc_init(void)
{
struct proc_dir_entry *entry;
Expand All @@ -711,6 +713,8 @@ static int __init input_proc_init(void)
return -ENOMEM;
}
entry->owner = THIS_MODULE;
input_fileops = *entry->proc_fops;
entry->proc_fops = &input_fileops;
entry->proc_fops->poll = input_devices_poll;
entry = create_proc_read_entry("handlers", 0, proc_bus_input_dir, input_handlers_read, NULL);
if (entry == NULL) {
Expand Down

0 comments on commit e334016

Please sign in to comment.