]> err.no Git - linux-2.6/commit
[PATCH] Fix signal sending in usbdevio on async URB completion
authorHarald Welte <laforge@gnumonks.org>
Mon, 10 Oct 2005 17:44:29 +0000 (19:44 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 10 Oct 2005 23:16:33 +0000 (16:16 -0700)
commit46113830a18847cff8da73005e57bc49c2f95a56
tree93946fc290d9481e7055217ff497583647d1e4d4
parent094804c5a132f04c12dd4902ee15c64362e5c1af
[PATCH] Fix signal sending in usbdevio on async URB completion

If a process issues an URB from userspace and (starts to) terminate
before the URB comes back, we run into the issue described above.  This
is because the urb saves a pointer to "current" when it is posted to the
device, but there's no guarantee that this pointer is still valid
afterwards.

In fact, there are three separate issues:

1) the pointer to "current" can become invalid, since the task could be
   completely gone when the URB completion comes back from the device.

2) Even if the saved task pointer is still pointing to a valid task_struct,
   task_struct->sighand could have gone meanwhile.

3) Even if the process is perfectly fine, permissions may have changed,
   and we can no longer send it a signal.

So what we do instead, is to save the PID and uid's of the process, and
introduce a new kill_proc_info_as_uid() function.

Signed-off-by: Harald Welte <laforge@gnumonks.org>
[ Fixed up types and added symbol exports ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/usb/core/devio.c
include/linux/sched.h
kernel/signal.c