Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/bluetooth remove KASSERT() checking for t_oproc at o...



details:   https://anonhg.NetBSD.org/src/rev/3d4a3adf893f
branches:  trunk
changeset: 368209:3d4a3adf893f
user:      plunky <plunky%NetBSD.org@localhost>
date:      Tue Jun 28 13:25:36 2022 +0000

description:
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@localhost

diffstat:

 sys/dev/bluetooth/bcsp.c   |  8 +++-----
 sys/dev/bluetooth/bth5.c   |  8 +++-----
 sys/dev/bluetooth/btuart.c |  8 +++-----
 3 files changed, 9 insertions(+), 15 deletions(-)

diffs (108 lines):

diff -r 88f6ea965242 -r 3d4a3adf893f sys/dev/bluetooth/bcsp.c
--- a/sys/dev/bluetooth/bcsp.c  Tue Jun 28 11:41:32 2022 +0000
+++ b/sys/dev/bluetooth/bcsp.c  Tue Jun 28 13:25:36 2022 +0000
@@ -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 @@
                }
        }
 
-       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 @@
 
        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 -r 88f6ea965242 -r 3d4a3adf893f sys/dev/bluetooth/bth5.c
--- a/sys/dev/bluetooth/bth5.c  Tue Jun 28 11:41:32 2022 +0000
+++ b/sys/dev/bluetooth/bth5.c  Tue Jun 28 13:25:36 2022 +0000
@@ -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@localhost>
  * 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 @@
                }
        }
 
-       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 @@
 
        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 -r 88f6ea965242 -r 3d4a3adf893f sys/dev/bluetooth/btuart.c
--- a/sys/dev/bluetooth/btuart.c        Tue Jun 28 11:41:32 2022 +0000
+++ b/sys/dev/bluetooth/btuart.c        Tue Jun 28 13:25:36 2022 +0000
@@ -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 @@
                }
        }
 
-       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 @@
 
        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;



Home | Main Index | Thread Index | Old Index