Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev/usb Pull up following revision(s) (requested by s...



details:   https://anonhg.NetBSD.org/src/rev/42d2c7094816
branches:  netbsd-8
changeset: 447447:42d2c7094816
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jan 11 15:52:24 2019 +0000

description:
Pull up following revision(s) (requested by skrll in ticket #1161):

        sys/dev/usb/usbdi.c: revision 1.181

Avoid use after free when closing interrupt pipe transfer by calling
upm_close before destroying the interupt pipe xfer.

Found by kasan on wiz's machine.

diffstat:

 sys/dev/usb/usbdi.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 17b4ea9b5c4e -r 42d2c7094816 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Fri Jan 11 15:37:28 2019 +0000
+++ b/sys/dev/usb/usbdi.c       Fri Jan 11 15:52:24 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.173.2.4 2018/11/20 16:05:38 martin Exp $   */
+/*     $NetBSD: usbdi.c,v 1.173.2.5 2019/01/11 15:52:24 martin Exp $   */
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.173.2.4 2018/11/20 16:05:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.173.2.5 2019/01/11 15:52:24 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -257,13 +257,14 @@
        LIST_REMOVE(pipe, up_next);
        pipe->up_endpoint->ue_refcnt--;
 
+       pipe->up_methods->upm_close(pipe);
+
        if (pipe->up_intrxfer != NULL) {
                usbd_unlock_pipe(pipe);
                usbd_destroy_xfer(pipe->up_intrxfer);
                usbd_lock_pipe(pipe);
        }
 
-       pipe->up_methods->upm_close(pipe);
        usbd_unlock_pipe(pipe);
        kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);
 



Home | Main Index | Thread Index | Old Index