summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-03-13 11:28:33 +0000
committerriastradh <riastradh@NetBSD.org>2022-03-13 11:28:33 +0000
commit0ffab83e00a86b89b87e6fa36c5892cb97c4ab67 (patch)
tree97e9e08672a8d82cd59ebf77bb5c3e3f51c8db5e /sys/dev/usb
parent6e57ea7f3e3d5cf034579cc53ec2a99dfd6ecf08 (diff)
usbdi(9): Assert sleepable in usbd_ar_pipe.
Caller of usbd_suspend_pipe or usbd_abort_pipe must be prepared to sleep for hardware to acknowledge abort and for in-flight callback on another CPU to complete. Let's catch the mistake early of calling them in non-sleepable contexts where they might get lucky.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/usbdi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c
index cb7e2ec285f..44eaa26b7e7 100644
--- a/sys/dev/usb/usbdi.c
+++ b/sys/dev/usb/usbdi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.233 2022/03/03 06:13:23 riastradh Exp $ */
+/* $NetBSD: usbdi.c,v 1.234 2022/03/13 11:28:33 riastradh 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.233 2022/03/03 06:13:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.234 2022/03/13 11:28:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1017,6 +1017,7 @@ usbd_ar_pipe(struct usbd_pipe *pipe)
USBHIST_CALLARGS(usbdebug, "pipe = %#jx", (uintptr_t)pipe, 0, 0, 0);
SDT_PROBE1(usb, device, pipe, abort__start, pipe);
+ ASSERT_SLEEPABLE();
KASSERT(mutex_owned(pipe->up_dev->ud_bus->ub_lock));
#ifdef USB_DEBUG