Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795054921; b=PReTJMkFT7TDK7HTi6UTbotdo1JIhCoKi1amGkK68X0yRFXoWKU3NIjnhdoPcQyDGWfm oFHZ4kCQe8tGQc6Nah3ko7GPWW3ALPVIz+1yi8/+Db8yjEUAtbysWBsFxo4QDpq1h/BS0 QjuZ20U6KsP24hlgL9ndURIq31fiL9thZiiG+k1wLBhjEqQtLAtDx2a1YgNh9mI+Cj9+Q FX/im0hiGFO7Hpp81/QsIQZqqNFpZEJOMFsNNYpGi5Q7IR7SSkQ8OsASxN0Gf/bdO61bg 1VxfNzltijhQd86OFve7vfwY9cgIpA9EAy8f8/xb7pGEGLMpWr0fEBmQFIE0+G4/pbw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795054921; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=767mfmFBc/1YbHhoEYfPOMPHTtRtqiRuui2Ey3dzFys=; b=r1aKOH1SkAexkMgYLIqgKdjol9orfT60GRG2sbJVxokCvGOLNUXv01PvLb7TP73BrRDC hXOBUhSduj5YPqZWkoly9/3jL1WaK3rCEmtOjVsrOSwMZBuKEos4Yn7pku8yYlYsWWLiC E/BePn6psL4NHPivkX2EByRFqpTmG0UGUZtpmnSDGUwm3EvJR/PpZ/hAN5Jk6Uh0+Lioc VpVlBNZuth+++TbwOl3bEFvy2Lj+RL3yHWPhNcUwYT8ewd43ZteiVlz+pnz1FMa2lSUjG o7j2T8IwNLU8Tg1S7QsDbL1yMhuARxfgErU38Lizme6enBT9/SWiz0pftEFG26xAN0Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Cb5ERn8b; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4CCA606A320; Thu, 19 Nov 2026 02:22:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Cb5ERn8b Received: by smtp.kernel.org (Postfix) with ESMTPSA id C347C1F000C4; Thu, 19 Nov 2026 02:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795054921; bh=767mfmFBc/1YbHhoEYfPOMPHTtRtqiRuui2Ey3dzFys=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Cb5ERn8bD8MXOxYn1O9Q8SvPqcaiSaANuRL7yRWEvyVaVl8hs7dC4a2FQrJy+8QbZ yp0zN19bvGegLaw0eY08cdNu/QsynzthcJag34ODo8omVYiEjGe1NfmWN992hHSiWk pXkhn7JejzL7lyBDtWwiX2RNaqusIrJ7KhifwnQo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+5f4b29d9fe710a964482@syzkaller.appspotmail.com, "Jiangong.Han" , Sasha Levin Subject: [PATCH 5.15 1447/2214] USB: usbmon: fix null-ptr-deref in mon_bus_remove() when mon_bus_init() fails Date: Wed, 18 Nov 2026 15:52:03 +0100 Message-ID: <20261118150108.992739539@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150009.797899913@linuxfoundation.org> References: <20261118150009.797899913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiangong.Han [ Upstream commit 0c6cae0f56239e3274b30dbe5b362cd297ccacc7 ] When mon_bus_init() fails to allocate the mon_bus struct, it returns without setting ubus->mon_bus, so mbus->mon_bus remains NULL. mon_bus_add() intentionally ignores this failure because the USB core does not require monitoring to be established for normal operation. However, when the HCD is later removed, usb_remove_hcd() fires the USB_BUS_REMOVE notifier which calls mon_bus_remove(), it dereferences ubus->mon_bus without checking for NULL, causing a null-ptr deference. Fix this by adding a NULL check for mbus at the top of mon_bus_remove(). If mon_bus_init() failed, ubus->mon_bus is NULL, meaning the bus was never tracked by the monitor, so there is nothing to clean up and returning early is correct. Reported-by: syzbot+5f4b29d9fe710a964482@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=5f4b29d9fe710a964482 Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Jiangong.Han Link: https://patch.msgid.link/20260801095128.46322-1-jiangong.han@windriver.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/mon/mon_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c index 9812d102a005f..6882d8938a546 100644 --- a/drivers/usb/mon/mon_main.c +++ b/drivers/usb/mon/mon_main.c @@ -210,6 +210,9 @@ static void mon_bus_remove(struct usb_bus *ubus) { struct mon_bus *mbus = ubus->mon_bus; + if (mbus == NULL) + return; + mutex_lock(&mon_lock); list_del(&mbus->bus_link); if (mbus->text_inited) -- 2.53.0