diff options
author | jhb <jhb@FreeBSD.org> | 2006-11-01 16:50:13 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-11-01 16:50:13 +0000 |
commit | 2a13022ca0c96ca052d43f178d9488ac7c21e7d5 (patch) | |
tree | 411e3d28e2595002fb294b6ea6b4d35585588ece | |
parent | 49d3deb803ef1ccaf6932074eabe55ad48eaf268 (diff) | |
download | FreeBSD-src-2a13022ca0c96ca052d43f178d9488ac7c21e7d5.zip FreeBSD-src-2a13022ca0c96ca052d43f178d9488ac7c21e7d5.tar.gz |
Increment nb_allocated while holding the pt_mtx lock to avoid races.
-rw-r--r-- | sys/kern/tty_pts.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c index 38e2c26..d5880a2 100644 --- a/sys/kern/tty_pts.c +++ b/sys/kern/tty_pts.c @@ -189,6 +189,7 @@ pty_new(void) mtx_unlock(&pt_mtx); return (NULL); } + nb_allocated++; pt = LIST_FIRST(&pt_free_list); if (pt) { LIST_REMOVE(pt, pt_list); @@ -204,7 +205,6 @@ pty_new(void) mtx_unlock(&pt_mtx); pt->pt_tty = ttyalloc(); } - nb_allocated++; return (pt); } |