Commit aec01c58 authored by Serge Hallyn's avatar Serge Hallyn Committed by Greg Kroah-Hartman

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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5c12e785
...@@ -407,7 +407,7 @@ static void async_completed(struct urb *urb) ...@@ -407,7 +407,7 @@ static void async_completed(struct urb *urb)
sinfo.si_errno = as->status; sinfo.si_errno = as->status;
sinfo.si_code = SI_ASYNCIO; sinfo.si_code = SI_ASYNCIO;
sinfo.si_addr = as->userurb; sinfo.si_addr = as->userurb;
pid = as->pid; pid = get_pid(as->pid);
uid = as->uid; uid = as->uid;
euid = as->euid; euid = as->euid;
secid = as->secid; secid = as->secid;
...@@ -422,9 +422,11 @@ static void async_completed(struct urb *urb) ...@@ -422,9 +422,11 @@ static void async_completed(struct urb *urb)
cancel_bulk_urbs(ps, as->bulk_addr); cancel_bulk_urbs(ps, as->bulk_addr);
spin_unlock(&ps->lock); spin_unlock(&ps->lock);
if (signr) if (signr) {
kill_pid_info_as_uid(sinfo.si_signo, &sinfo, pid, uid, kill_pid_info_as_uid(sinfo.si_signo, &sinfo, pid, uid,
euid, secid); euid, secid);
put_pid(pid);
}
wake_up(&ps->wait); wake_up(&ps->wait);
} }
......
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