Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb also set ifc->ui_endpoints to NULL in usbd_free_...



details:   https://anonhg.NetBSD.org/src/rev/c4f92215e65d
branches:  trunk
changeset: 1010662:c4f92215e65d
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun May 31 18:20:23 2020 +0000

description:
also set ifc->ui_endpoints to NULL in usbd_free_iface_data() when the value
is freed, to make it impossible to re-enter this by mistake

very likely has no effect for the syzbot problem, but good to do nevetheless

Reported-by: syzbot+c555801d6bc0d768f402%syzkaller.appspotmail.com@localhost

diffstat:

 sys/dev/usb/usb_subr.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 5389eac6052b -r c4f92215e65d sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c    Sun May 31 17:52:58 2020 +0000
+++ b/sys/dev/usb/usb_subr.c    Sun May 31 18:20:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_subr.c,v 1.245 2020/05/31 17:52:58 maxv Exp $      */
+/*     $NetBSD: usb_subr.c,v 1.246 2020/05/31 18:20:23 jdolecek Exp $  */
 /*     $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.245 2020/05/31 17:52:58 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.246 2020/05/31 18:20:23 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -507,6 +507,7 @@
                int nendpt = ifc->ui_idesc->bNumEndpoints;
                size_t sz = nendpt * sizeof(struct usbd_endpoint);
                kmem_free(ifc->ui_endpoints, sz);
+               ifc->ui_endpoints = NULL;
        }
 }
 



Home | Main Index | Thread Index | Old Index