aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tcb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tcb.c b/src/tcb.c
index 48f1d3b..506b756 100644
--- a/src/tcb.c
+++ b/src/tcb.c
@@ -369,7 +369,14 @@ struct tcb *get_tcb(id_t tid)
if (tid <= 0)
return NULL;
- return tcbs[tid & (num_tids - 1)];
+ struct tcb *t = tcbs[tid & (num_tids - 1)];
+ if (!t)
+ return NULL;
+
+ if (t->tid != tid)
+ return NULL;
+
+ return t;
}
void set_return(struct tcb *t, vm_t v)