提交 aec01c58 编写于 作者: S Serge Hallyn 提交者: 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: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com>
Cc: stable <stable@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册