diff options
author | Serge Hallyn <serge.hallyn@canonical.com> | 2011-09-26 11:18:29 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-09-26 19:12:26 -0400 |
commit | aec01c5895051849ed842dc5b8794017a7751f28 (patch) | |
tree | 0dcf873f047c48a7f3513349c13998b048e4e0fd /drivers/usb/core/devio.c | |
parent | 5c12e7856d75f68c1ca8372d6cc76cdbc71763c0 (diff) |
USB: pid_ns: ensure pid is not freed during kill_pid_info_as_uid
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>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/devio.c')
-rw-r--r-- | drivers/usb/core/devio.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 37518dfdeb98..eea53ebe6706 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 | } |