summaryrefslogtreecommitdiff
path: root/sys/kern/tty_inq.c
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2017-01-13 16:37:38 +0000
committerIan Lepore <ian@FreeBSD.org>2017-01-13 16:37:38 +0000
commita6f63533a7045d56ea46bd68a14cbf4053e63aa5 (patch)
tree2eca54863fed9f962b0c1ca85741ac42749b2c21 /sys/kern/tty_inq.c
parent2f21ec0129dc3be555536d5177c5e0f4f8728f6b (diff)
downloadsrc-test2-a6f63533a7045d56ea46bd68a14cbf4053e63aa5.tar.gz
src-test2-a6f63533a7045d56ea46bd68a14cbf4053e63aa5.zip
Notes
Diffstat (limited to 'sys/kern/tty_inq.c')
-rw-r--r--sys/kern/tty_inq.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/tty_inq.c b/sys/kern/tty_inq.c
index 97017ac75a41..163b19459fe9 100644
--- a/sys/kern/tty_inq.c
+++ b/sys/kern/tty_inq.c
@@ -112,7 +112,7 @@ static uma_zone_t ttyinq_zone;
TTYINQ_INSERT_TAIL(ti, tib); \
} while (0)
-void
+int
ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t size)
{
struct ttyinq_block *tib;
@@ -134,8 +134,14 @@ ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t size)
tib = uma_zalloc(ttyinq_zone, M_WAITOK);
tty_lock(tp);
+ if (tty_gone(tp)) {
+ uma_zfree(ttyinq_zone, tib);
+ return (ENXIO);
+ }
+
TTYINQ_INSERT_TAIL(ti, tib);
}
+ return (0);
}
void