Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4301747784 for ; Tue, 27 Feb 2024 18:41:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709059311; cv=none; b=jZwO72IZUoN06Oa5DypbLawmXEpE0KBfTLRBvmfcle6Z57PkDZC27VqMXlFrQGn19wKZ172cDC8ZlgnP+/BddoQ6DRvB/mfMpszxRmCCihcGj6I+Vzj/HfDVenGt3OVCJg2MshmmnORd+WOoK41NeZg0IphKLLUU2SgUs2EI4qs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709059311; c=relaxed/simple; bh=HfrZz3Dnaqu0WCDjxxy/lNBCFPBV23ukeWPeBsq0Tg0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mxATptGz08dd5uoszaLuE6D+MXqCENOHpd2CcXreCkMMjCmsaiAZPdSLh2axVWF9ZoPoInnejaAV+fIDLnr7RvPYtvekqQAUyNhFNzwTOvEdUUisq+1G30/fj/vBLCp2312NBTtmDfmq+wxIDR6LHHlfiXbNwXobZ0J4gWND0+w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1TUUIdnj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1TUUIdnj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71E5EC433C7; Tue, 27 Feb 2024 18:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709059310; bh=HfrZz3Dnaqu0WCDjxxy/lNBCFPBV23ukeWPeBsq0Tg0=; h=From:To:Cc:Subject:Date:Reply-to:From; b=1TUUIdnjN1xvxaKFqiW7vFgzqooj+ReAIymMQf/pq+zJ1H6xaN3xGhnN8aR2UcD6L 4vy6MeiKySnRF8J0JkGCp+IJWmOFI2bs5a7RjU3uyp12MqWcqMpx50J1hD+2xFwKqo ShVysBhX7EYgKvACZK1+WmjTY02MnQrNKtzuF8nM= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-46941: usb: dwc3: core: Do core softreset when switch mode Date: Tue, 27 Feb 2024 19:40:43 +0100 Message-ID: <20240227184057.2368370-6-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: usb: dwc3: core: Do core softreset when switch mode According to the programming guide, to switch mode for DRD controller, the driver needs to do the following. To switch from device to host: 1. Reset controller with GCTL.CoreSoftReset 2. Set GCTL.PrtCapDir(host mode) 3. Reset the host with USBCMD.HCRESET 4. Then follow up with the initializing host registers sequence To switch from host to device: 1. Reset controller with GCTL.CoreSoftReset 2. Set GCTL.PrtCapDir(device mode) 3. Reset the device with DCTL.CSftRst 4. Then follow up with the initializing registers sequence Currently we're missing step 1) to do GCTL.CoreSoftReset and step 3) of switching from host to device. John Stult reported a lockup issue seen with HiKey960 platform without these steps[1]. Similar issue is observed with Ferry's testing platform[2]. So, apply the required steps along with some fixes to Yu Chen's and John Stultz's version. The main fixes to their versions are the missing wait for clocks synchronization before clearing GCTL.CoreSoftReset and only apply DCTL.CSftRst when switching from host to device. [1] https://lore.kernel.org/linux-usb/20210108015115.27920-1-john.stultz@linaro.org/ [2] https://lore.kernel.org/linux-usb/0ba7a6ba-e6a7-9cd4-0695-64fc927e01f1@gmail.com/ The Linux kernel CVE team has assigned CVE-2021-46941 to this issue. Affected and fixed versions =========================== Issue introduced in 4.12 with commit 41ce1456e1db and fixed in 5.10.36 with commit fce7bbcd07d5 Issue introduced in 4.12 with commit 41ce1456e1db and fixed in 5.11.20 with commit 800f58217626 Issue introduced in 4.12 with commit 41ce1456e1db and fixed in 5.12.3 with commit 1c10fd60c859 Issue introduced in 4.12 with commit 41ce1456e1db and fixed in 5.13 with commit f88359e1588b Please see https://www.kernel.org or a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2021-46941 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/usb/dwc3/core.c drivers/usb/dwc3/core.h Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/fce7bbcd07d59ac30dba8ce225316b3b4c1c7b50 https://git.kernel.org/stable/c/800f58217626c8b147aa40660e572ed8a0d56e3b https://git.kernel.org/stable/c/1c10fd60c8595ea7ff7e29d3cf1fa88069941da3 https://git.kernel.org/stable/c/f88359e1588b85cf0e8209ab7d6620085f3441d9