diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2006-10-02 05:17:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:15 -0400 |
commit | 2425c08b37244005ff221efe4957d8aaff18609c (patch) | |
tree | 488a298587acb651bd6964c0f9d53c9f48327362 /drivers/usb/core/devio.c | |
parent | 43fa1adb9334bf4585cd53144eb5911488f85bc7 (diff) |
[PATCH] usb: fixup usb so it uses struct pid
The problem with remembering a user space process by its pid is that it is
possible that the process will exit, pid wrap around will occur.
Converting to a struct pid avoid that problem, and paves the way for
implementing a pid namespace.
Also since usb is the only user of kill_proc_info_as_uid rename
kill_proc_info_as_uid to kill_pid_info_as_uid and have the new version take
a struct pid.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/usb/core/devio.c')
-rw-r--r-- | drivers/usb/core/devio.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index a94c63bef632..3f509beb88e4 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -65,7 +65,7 @@ DEFINE_MUTEX(usbfs_mutex); | |||
65 | struct async { | 65 | struct async { |
66 | struct list_head asynclist; | 66 | struct list_head asynclist; |
67 | struct dev_state *ps; | 67 | struct dev_state *ps; |
68 | pid_t pid; | 68 | struct pid *pid; |
69 | uid_t uid, euid; | 69 | uid_t uid, euid; |
70 | unsigned int signr; | 70 | unsigned int signr; |
71 | unsigned int ifnum; | 71 | unsigned int ifnum; |
@@ -225,6 +225,7 @@ static struct async *alloc_async(unsigned int numisoframes) | |||
225 | 225 | ||
226 | static void free_async(struct async *as) | 226 | static void free_async(struct async *as) |
227 | { | 227 | { |
228 | put_pid(as->pid); | ||
228 | kfree(as->urb->transfer_buffer); | 229 | kfree(as->urb->transfer_buffer); |
229 | kfree(as->urb->setup_packet); | 230 | kfree(as->urb->setup_packet); |
230 | usb_free_urb(as->urb); | 231 | usb_free_urb(as->urb); |
@@ -317,7 +318,7 @@ static void async_completed(struct urb *urb, struct pt_regs *regs) | |||
317 | sinfo.si_errno = as->urb->status; | 318 | sinfo.si_errno = as->urb->status; |
318 | sinfo.si_code = SI_ASYNCIO; | 319 | sinfo.si_code = SI_ASYNCIO; |
319 | sinfo.si_addr = as->userurb; | 320 | sinfo.si_addr = as->userurb; |
320 | kill_proc_info_as_uid(as->signr, &sinfo, as->pid, as->uid, | 321 | kill_pid_info_as_uid(as->signr, &sinfo, as->pid, as->uid, |
321 | as->euid, as->secid); | 322 | as->euid, as->secid); |
322 | } | 323 | } |
323 | snoop(&urb->dev->dev, "urb complete\n"); | 324 | snoop(&urb->dev->dev, "urb complete\n"); |
@@ -573,7 +574,7 @@ static int usbdev_open(struct inode *inode, struct file *file) | |||
573 | INIT_LIST_HEAD(&ps->async_completed); | 574 | INIT_LIST_HEAD(&ps->async_completed); |
574 | init_waitqueue_head(&ps->wait); | 575 | init_waitqueue_head(&ps->wait); |
575 | ps->discsignr = 0; | 576 | ps->discsignr = 0; |
576 | ps->disc_pid = current->pid; | 577 | ps->disc_pid = get_pid(task_pid(current)); |
577 | ps->disc_uid = current->uid; | 578 | ps->disc_uid = current->uid; |
578 | ps->disc_euid = current->euid; | 579 | ps->disc_euid = current->euid; |
579 | ps->disccontext = NULL; | 580 | ps->disccontext = NULL; |
@@ -611,6 +612,7 @@ static int usbdev_release(struct inode *inode, struct file *file) | |||
611 | usb_autosuspend_device(dev, 1); | 612 | usb_autosuspend_device(dev, 1); |
612 | usb_unlock_device(dev); | 613 | usb_unlock_device(dev); |
613 | usb_put_dev(dev); | 614 | usb_put_dev(dev); |
615 | put_pid(ps->disc_pid); | ||
614 | kfree(ps); | 616 | kfree(ps); |
615 | return 0; | 617 | return 0; |
616 | } | 618 | } |
@@ -1063,7 +1065,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1063 | as->userbuffer = NULL; | 1065 | as->userbuffer = NULL; |
1064 | as->signr = uurb->signr; | 1066 | as->signr = uurb->signr; |
1065 | as->ifnum = ifnum; | 1067 | as->ifnum = ifnum; |
1066 | as->pid = current->pid; | 1068 | as->pid = get_pid(task_pid(current)); |
1067 | as->uid = current->uid; | 1069 | as->uid = current->uid; |
1068 | as->euid = current->euid; | 1070 | as->euid = current->euid; |
1069 | security_task_getsecid(current, &as->secid); | 1071 | security_task_getsecid(current, &as->secid); |