diff options
| author | plunky <plunky@NetBSD.org> | 2022-06-28 13:25:36 +0000 |
|---|---|---|
| committer | plunky <plunky@NetBSD.org> | 2022-06-28 13:25:36 +0000 |
| commit | 8817d8b129ca0fd3659bbbeaa05cd5ff69870ce3 (patch) | |
| tree | 84dcf3ba3bd396717d389f3e878b2abce4dc111d /sys/dev | |
| parent | 47b7f8298b9c45bb08c1a043b63b58dd5a642a2c (diff) | |
remove KASSERT() checking for t_oproc at open since assigning this line
discipline to a pty may not have that set. Instead do a runtime check to
ensure that the function exists before calling it, as ttstart() handles it.
Same code in btuart.c, bcsp.c and bth5.c
Reported-by: syzbot+766981eef92a3cd0352a@syzkaller.appspotmail.com
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/bluetooth/bcsp.c | 8 | ||||
| -rw-r--r-- | sys/dev/bluetooth/bth5.c | 8 | ||||
| -rw-r--r-- | sys/dev/bluetooth/btuart.c | 8 |
3 files changed, 9 insertions, 15 deletions
diff --git a/sys/dev/bluetooth/bcsp.c b/sys/dev/bluetooth/bcsp.c index 960d21848ab..2b6aa9157a2 100644 --- a/sys/dev/bluetooth/bcsp.c +++ b/sys/dev/bluetooth/bcsp.c @@ -1,4 +1,4 @@ -/* $NetBSD: bcsp.c,v 1.31 2019/01/24 09:33:03 knakahara Exp $ */ +/* $NetBSD: bcsp.c,v 1.32 2022/06/28 13:25:36 plunky Exp $ */ /* * Copyright (c) 2007 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.31 2019/01/24 09:33:03 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.32 2022/06/28 13:25:36 plunky Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -387,8 +387,6 @@ bcspopen(dev_t device __unused, struct tty *tp) } } - KASSERT(tp->t_oproc != NULL); - cfdata = malloc(sizeof(struct cfdata), M_DEVBUF, M_WAITOK); for (unit = 0; unit < bcsp_cd.cd_ndevs; unit++) if (device_lookup(&bcsp_cd, unit) == NULL) @@ -597,7 +595,7 @@ bcsp_slip_transmit(struct tty *tp) sc->sc_stats.byte_tx += count; - if (tp->t_outq.c_cc != 0) + if (tp->t_outq.c_cc != 0 && tp->t_oproc != NULL) (*tp->t_oproc)(tp); return 0; diff --git a/sys/dev/bluetooth/bth5.c b/sys/dev/bluetooth/bth5.c index 030adc07151..06458b5611d 100644 --- a/sys/dev/bluetooth/bth5.c +++ b/sys/dev/bluetooth/bth5.c @@ -1,4 +1,4 @@ -/* $NetBSD: bth5.c,v 1.6 2019/11/16 22:06:49 mlelstv Exp $ */ +/* $NetBSD: bth5.c,v 1.7 2022/06/28 13:25:36 plunky Exp $ */ /* * Copyright (c) 2017 Nathanial Sloss <nathanialsloss@yahoo.com.au> * All rights reserved. @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bth5.c,v 1.6 2019/11/16 22:06:49 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bth5.c,v 1.7 2022/06/28 13:25:36 plunky Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -392,8 +392,6 @@ bth5open(dev_t device __unused, struct tty *tp) } } - KASSERT(tp->t_oproc != NULL); - cfdata = malloc(sizeof(struct cfdata), M_DEVBUF, M_WAITOK); for (unit = 0; unit < bthfive_cd.cd_ndevs; unit++) if (device_lookup(&bthfive_cd, unit) == NULL) @@ -633,7 +631,7 @@ bth5_slip_transmit(struct tty *tp) sc->sc_stats.byte_tx += count; - if (tp->t_outq.c_cc != 0) + if (tp->t_outq.c_cc != 0 && tp->t_oproc != NULL) (*tp->t_oproc)(tp); return 0; diff --git a/sys/dev/bluetooth/btuart.c b/sys/dev/bluetooth/btuart.c index ac1a3a9bcc6..0bdd0aaaff4 100644 --- a/sys/dev/bluetooth/btuart.c +++ b/sys/dev/bluetooth/btuart.c @@ -1,4 +1,4 @@ -/* $NetBSD: btuart.c,v 1.29 2019/01/24 09:33:03 knakahara Exp $ */ +/* $NetBSD: btuart.c,v 1.30 2022/06/28 13:25:36 plunky Exp $ */ /*- * Copyright (c) 2006, 2007 KIYOHARA Takashi @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: btuart.c,v 1.29 2019/01/24 09:33:03 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: btuart.c,v 1.30 2022/06/28 13:25:36 plunky Exp $"); #include <sys/param.h> #include <sys/conf.h> @@ -240,8 +240,6 @@ btuartopen(dev_t devno __unused, struct tty *tp) } } - KASSERT(tp->t_oproc != NULL); - cfdata = malloc(sizeof(struct cfdata), M_DEVBUF, M_WAITOK); for (unit = 0; unit < btuart_cd.cd_ndevs; unit++) if (device_lookup(&btuart_cd, unit) == NULL) @@ -543,7 +541,7 @@ btuartstart(struct tty *tp) sc->sc_stats.byte_tx += count; - if (tp->t_outq.c_cc != 0) + if (tp->t_outq.c_cc != 0 && tp->t_oproc != NULL) (*tp->t_oproc)(tp); return 0; |
