aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorSerge Hallyn <serge.hallyn@canonical.com>2011-09-26 11:18:29 -0400
committerHerton Ronaldo Krzesinski <herton.krzesinski@canonical.com>2011-11-21 12:54:55 -0500
commit7a0d1d50ac86b769fc641274bfb7ea2f5b61d4c5 (patch)
tree49dd528839e3361d11f9f25147fe245b3eaccfb0 /drivers/usb
parente34c4c52f88e0102bd3c4dac24fcbb96ed7bc369 (diff)
USB: pid_ns: ensure pid is not freed during kill_pid_info_as_uid
BugLink: http://bugs.launchpad.net/bugs/890952 commit aec01c5895051849ed842dc5b8794017a7751f28 upstream. Alan Stern points out that after spin_unlock(&ps->lock) there is no guarantee that ps->pid won't be freed. Since kill_pid_info_as_uid() is called after the spin_unlock(), the pid passed to it must be pinned. Reported-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/devio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 1d73709c41b..0ca54e22d31 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -407,7 +407,7 @@ static void async_completed(struct urb *urb)
407 sinfo.si_errno = as->status; 407 sinfo.si_errno = as->status;
408 sinfo.si_code = SI_ASYNCIO; 408 sinfo.si_code = SI_ASYNCIO;
409 sinfo.si_addr = as->userurb; 409 sinfo.si_addr = as->userurb;
410 pid = as->pid; 410 pid = get_pid(as->pid);
411 uid = as->uid; 411 uid = as->uid;
412 euid = as->euid; 412 euid = as->euid;
413 secid = as->secid; 413 secid = as->secid;
@@ -422,9 +422,11 @@ static void async_completed(struct urb *urb)
422 cancel_bulk_urbs(ps, as->bulk_addr); 422 cancel_bulk_urbs(ps, as->bulk_addr);
423 spin_unlock(&ps->lock); 423 spin_unlock(&ps->lock);
424 424
425 if (signr) 425 if (signr) {
426 kill_pid_info_as_uid(sinfo.si_signo, &sinfo, pid, uid, 426 kill_pid_info_as_uid(sinfo.si_signo, &sinfo, pid, uid,
427 euid, secid); 427 euid, secid);
428 put_pid(pid);
429 }
428 430
429 wake_up(&ps->wait); 431 wake_up(&ps->wait);
430} 432}