Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Avoid use after free when closing interrupt pipe...
details: https://anonhg.NetBSD.org/src/rev/eedd7537e737
branches: trunk
changeset: 447430:eedd7537e737
user: skrll <skrll%NetBSD.org@localhost>
date: Thu Jan 10 22:13:07 2019 +0000
description:
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 c1b4171b3d4e -r eedd7537e737 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c Thu Jan 10 22:02:16 2019 +0000
+++ b/sys/dev/usb/usbdi.c Thu Jan 10 22:13:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.180 2018/11/16 00:34:50 manu Exp $ */
+/* $NetBSD: usbdi.c,v 1.181 2019/01/10 22:13:07 skrll 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.180 2018/11/16 00:34:50 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.181 2019/01/10 22:13:07 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -258,13 +258,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