summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_pts.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-11-01 16:50:13 +0000
committerjhb <jhb@FreeBSD.org>2006-11-01 16:50:13 +0000
commit2a13022ca0c96ca052d43f178d9488ac7c21e7d5 (patch)
tree411e3d28e2595002fb294b6ea6b4d35585588ece /sys/kern/tty_pts.c
parent49d3deb803ef1ccaf6932074eabe55ad48eaf268 (diff)
downloadFreeBSD-src-2a13022ca0c96ca052d43f178d9488ac7c21e7d5.zip
FreeBSD-src-2a13022ca0c96ca052d43f178d9488ac7c21e7d5.tar.gz
Increment nb_allocated while holding the pt_mtx lock to avoid races.
Diffstat (limited to 'sys/kern/tty_pts.c')
-rw-r--r--sys/kern/tty_pts.c2
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);
}
OpenPOWER on IntegriCloud