提交 61232f2f 编写于 作者: J Jeff Dike 提交者: Linus Torvalds

[PATCH] uml: fix exitcall ordering bug

This fixes an exitcall ordering bug - calls to ignore_sigio_fd can come from
exitcalls that come after the sigio thread has been killed.  This would cause
shutdown to hang or crash.

Fixed by having ignore_sigio_fd check that the thread is present before trying
to communicate with it.
Signed-off-by: NJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 8e64d96a
...@@ -191,6 +191,13 @@ int ignore_sigio_fd(int fd) ...@@ -191,6 +191,13 @@ int ignore_sigio_fd(int fd)
struct pollfd *p; struct pollfd *p;
int err = 0, i, n = 0; int err = 0, i, n = 0;
/* This is called from exitcalls elsewhere in UML - if
* sigio_cleanup has already run, then update_thread will hang
* or fail because the thread is no longer running.
*/
if(write_sigio_pid == -1)
return -EIO;
sigio_lock(); sigio_lock();
for(i = 0; i < current_poll.used; i++){ for(i = 0; i < current_poll.used; i++){
if(current_poll.poll[i].fd == fd) break; if(current_poll.poll[i].fd == fd) break;
...@@ -215,7 +222,7 @@ int ignore_sigio_fd(int fd) ...@@ -215,7 +222,7 @@ int ignore_sigio_fd(int fd)
update_thread(); update_thread();
out: out:
sigio_unlock(); sigio_unlock();
return(err); return err;
} }
static struct pollfd *setup_initial_poll(int fd) static struct pollfd *setup_initial_poll(int fd)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册