From 0ffab83e00a86b89b87e6fa36c5892cb97c4ab67 Mon Sep 17 00:00:00 2001 From: riastradh Date: Sun, 13 Mar 2022 11:28:33 +0000 Subject: 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. --- sys/dev/usb/usbdi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sys/dev') 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 -__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 -- cgit