Skip to content

Commit

Permalink
[PATCH] uml: fix exitcall ordering bug
Browse files Browse the repository at this point in the history
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: Jeff Dike <[email protected]>
Cc: Paolo 'Blaisorblade' Giarrusso <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
cfd-36 authored and Linus Torvalds committed Jul 10, 2006
1 parent 8e64d96 commit 61232f2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion arch/um/os-Linux/sigio.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ int ignore_sigio_fd(int fd)
struct pollfd *p;
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();
for(i = 0; i < current_poll.used; i++){
if(current_poll.poll[i].fd == fd) break;
Expand All @@ -215,7 +222,7 @@ int ignore_sigio_fd(int fd)
update_thread();
out:
sigio_unlock();
return(err);
return err;
}

static struct pollfd *setup_initial_poll(int fd)
Expand Down

0 comments on commit 61232f2

Please sign in to comment.