From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 457DA4EC65C; Mon, 31 Aug 2026 13:40:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788183631; cv=none; b=t/vkMynfu5SoZ9WVSTVyTCZ9LwHVCzWMcHkWDrWqtYhOGdd0W80vfPE3mKd3AHW3ifY0YptaoE6HRaU5dP9GCEUnlaQlDDSW2btWaF9VUUhpYpM2XIVtC0Shnyr15Fd9Ko7QOsxTvJHdCYXFYh20KbQmYB4sKXYB4Z/mKBZlIdI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788183631; c=relaxed/simple; bh=EdYWETfThWlgPANjXdIfzZbkzKKC2cyEpOtHh3brR6A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OpjVJz5DQzhIGHdRYUEpncbpx3nigYGVFvlsEDitVkX20VSPqZ1oMCcScxlVLeCK0a9bmWf6AN7HMWCnHygWELik+VWY+/HysjGDljxueCKGlxxAKQUxzNuTa8tXGpb49/F4k8HR5yQ42bTbbh77D7ci1FIPwkY0yQELXGjcHO0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Wh9I+K0+; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Wh9I+K0+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AAD51F00A3D; Mon, 31 Aug 2026 13:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788183630; bh=ikbWCuilLiAakYvHlDRMn7Ec3Q/hkAoYvG7h+zh7oRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Wh9I+K0+H4HqNQ2IpzJkKQydfbjeT8ssOiShnqrmVcGOKRAsQrRIdUxq4ww1T4ngi PxP+sx8MdsxGDn345Pu1RUZjHQm8A0JbIMSme0GCglSehES0dwWHRI9iEZX5i2J0tR D0rqUV+6LPqonsMuP7dbMplh3jVIxSu75/Nbj4bA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Griffin Kroah-Hartman Subject: [PATCH 7.2 62/71] usb: core: Add lock to usb_wakeup_notification() Date: Mon, 31 Aug 2026 15:34:27 +0200 Message-ID: <20260831133402.467405869@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260831133359.055927882@linuxfoundation.org> References: <20260831133359.055927882@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Griffin Kroah-Hartman commit e263e18a9e7b1ff3e7301f0801c6ff87c31adfb6 upstream. Add a spin lock to usb_wakeup notification to prevent a race condition with dereferencing freed memory. This could be hit by the xHCI driver as it calls this function from an IRQ and could race with the hub_disconnect() function, which properly grabs this lock to protect the state of the device. Assisted-by: gkh_clanker_t1000 Signed-off-by: Griffin Kroah-Hartman Link: https://patch.msgid.link/20260713-usb_core_patches_1-v1-3-7721c2b33f53@kroah.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -753,10 +753,12 @@ void usb_wakeup_notification(struct usb_ { struct usb_hub *hub; struct usb_port *port_dev; + unsigned long flags; if (!hdev) return; + spin_lock_irqsave(&device_state_lock, flags); hub = usb_hub_to_struct_hub(hdev); if (hub) { port_dev = hub->ports[portnum - 1]; @@ -766,6 +768,7 @@ void usb_wakeup_notification(struct usb_ set_bit(portnum, hub->wakeup_bits); kick_hub_wq(hub); } + spin_unlock_irqrestore(&device_state_lock, flags); } EXPORT_SYMBOL_GPL(usb_wakeup_notification);