The task can exit between find_task_by_vpid() and task_session_vnr(), in
that unlikely case sys_getsid() returns 0 instead of -ESRCH.
The bug was introduced by me in ac9a8e3f0f43d20fc316162e8e5f9186d295ff49.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 25/kernel/sys.c~1_GETSID 2008-03-20 18:21:17.000000000 +0300
+++ 25/kernel/sys.c 2008-03-23 19:25:36.000000000 +0300
@@ -1019,19 +1019,19 @@ asmlinkage long sys_getsid(pid_t pid)
if (!pid)
return task_session_vnr(current);
else {
- int retval;
+ int retval = 0;
struct task_struct *p;
rcu_read_lock();
p = find_task_by_vpid(pid);
- retval = -ESRCH;
if (p) {
retval = security_task_getsid(p);
if (!retval)
retval = task_session_vnr(p);
}
rcu_read_unlock();
- return retval;
+
+ return retval ?: -ESRCH;
}
}
--
| Christoph Lameter | Re: [RFC 00/15] x86_64: Optimize percpu accesses |
| Linus Torvalds | Re: [Patch v2] Make PCI extended config space (MMCONFIG) a driver opt-in |
| Greg Kroah-Hartman | [PATCH 005/196] Chinese: add translation of SubmittingDrivers |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
git: | |
| David Miller | [GIT]: Networking |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Christoph Hellwig | Re: [PATCH 06/32] IGET: Mark iget() and read_inode() as being obsolete [try #2] |
| Gerrit Renker | [PATCH 26/37] dccp: Integration of dynamic feature activation - part 1 (socket set... |
