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 E486F47A87D; Sat, 12 Sep 2026 11:53:08 +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=1789213991; cv=none; b=PaZ+IBGPj4jbaSmjKqJj/INtNzYTpzBYM3YaQmMuX5bPw93V2qod5oxqQCOEEcJXfYvSwgJtlJn0gA/N8dtyWvZZ1vOT4J5vEsPW5LTsENeYfoJTRmRHpRSFrYxYm1+8MjV0rni8nPOqmMaI7VrYxV3qSOpDd59yGQmQO8f9pBM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789213991; c=relaxed/simple; bh=cFzE3nPmjlM8XtE4rXIku098gUQiUQVSdcGt/ZKZhFQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IUqpZNPFXbij4GKzDheXBPbNfkEhyWcoRRb3u53JulIbZlCWKGroQIwRgd8gB87yvAHhCZRDBrkmRloaBOj0jKcCcIIwKBGJ8dd2FIUMLJ5agBZ5aH+6kwTMceMWKxAJUn88b/MsdzeUnuWXAciz742V8Ah8kWT7yFxGxFS4PkI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TIvtDIPL; 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="TIvtDIPL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDF841F00893; Sat, 12 Sep 2026 11:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789213988; bh=uHNE5qDMKoBwWJ8fJ1TouuybDGuHPGlpx0Ex4atRIG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TIvtDIPLH4Oue++F+ID01JEeE1akHVW/zo5HVztH8lNwq0SnMTbqeNtI5Ff7W2eL4 sJzoT0XQxzEEHRrJRhV5fu9800b7WL9tLWHE/QZa4MB1JqrxDDT0Vkj8YlD6A9fjDR MWsi5qeGbHMI7E1pZehxZpRXQjoKaPOUDCz1An9Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+99d6c66dbbc484f50e1c@syzkaller.appspotmail.com, "Jiangong.Han" , Hans Verkuil Subject: [PATCH 6.12 0191/1376] media: em28xx: fix use-after-free of dev_next->devlist on disconnect Date: Sat, 12 Sep 2026 08:43:37 +0200 Message-ID: <20260912065611.808278741@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.535295758@linuxfoundation.org> References: <20260912065607.535295758@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiangong.Han commit 826915b6b65e2d3251e7248ea54289a22d748c84 upstream. When a device with has_dual_ts=1 is probed and the is_audio_only path is taken, both dev and dev->dev_next are added to the global em28xx_devlist via em28xx_init_extension(). However, during disconnect, em28xx_close_extension(dev) only calls list_del(&dev->devlist), leaving dev->dev_next->devlist still linked in the global list. When dev_next is subsequently freed via kref_put(), its devlist entry becomes a dangling pointer in em28xx_devlist. The next device probe that calls em28xx_init_extension() triggers a list corruption BUG when list_add_tail detects the freed node. This bug was exposed by commit a368ecde8a50 ("USB: core: Fix duplicate endpoint bug by clearing reserved bits in the descriptor") which clears reserved bits in bEndpointAddress during endpoint parsing. This causes fuzzed endpoint addresses like 0xf3 to be normalized to 0x83, which em28xx interprets as a vendor audio endpoint, enabling the is_audio_only + has_dual_ts code path that was previously unreachable with such descriptors. Fix this by removing dev->dev_next->devlist from the global list in em28xx_close_extension() before the device is freed. Fixes: f410b4093fdd ("media: em28xx: split up em28xx_dvb_init to reduce stack size") Cc: stable@vger.kernel.org Reported-by: syzbot+99d6c66dbbc484f50e1c@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=99d6c66dbbc484f50e1c Signed-off-by: Jiangong.Han Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/em28xx/em28xx-core.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/media/usb/em28xx/em28xx-core.c +++ b/drivers/media/usb/em28xx/em28xx-core.c @@ -1134,6 +1134,8 @@ void em28xx_close_extension(struct em28x ops->fini(dev); } } + if (dev->dev_next) + list_del(&dev->dev_next->devlist); list_del(&dev->devlist); mutex_unlock(&em28xx_devlist_mutex); }