From mboxrd@z Thu Jan 1 00:00:00 1970 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 6B0D81CABF for ; Fri, 8 Nov 2024 05:24:20 +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=1731043460; cv=none; b=mcCTAFFjWdYJigc1u/yptZ8OV/em2wMDLYCiFQ4/du0PvPye5pOTE27nIpYtpblNJB/Ithb7TBGjK+yb0w8nRQbj/+qWJJgClr0I0AXXZ2Dbjda/WcF0mmtoywivQ6dVRQTUevUSka2BRMHw+cK1LfAncoI4fPs/3/GN6AUoQOY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731043460; c=relaxed/simple; bh=NVtgBYsjJ9xPTOFLRzWl0+vdeMF+87VuVu2BUtyjNfw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MlkkYMBx2q3zxjH5zVOld7uFc+AILrt+nC6a1fznyAqNC7rdZBfXXXSq9o9M7e/78yi5gbBj9BwnFY2I6XrF5b/eex1XQQRAvlWJBM5XVMZePG51awlbGPoyFbvkaHUj6aDGl39iTnQ4Jl636s+M/Rw4h+Hhv3L55HtqYjeJGHY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=s4Oa8+Fg; 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="s4Oa8+Fg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A722C4CECE; Fri, 8 Nov 2024 05:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1731043460; bh=NVtgBYsjJ9xPTOFLRzWl0+vdeMF+87VuVu2BUtyjNfw=; h=From:To:Cc:Subject:Date:Reply-to:From; b=s4Oa8+Fg66U+j5H0VpatFWj0pA0ovBgdaD+5VB166TH4epB94hoAxz6etNnreGyri aqjak43jxoHrASaWSHxq/YGmfRhFImaI44Z5FsWqn70txLbHXy/yXo9/vJ65SuucEw fpoImr5LWELBJBBk2F2sQHCvW8G8l4z4lmtUP9LM= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-50175: media: qcom: camss: Remove use_count guard in stop_streaming Date: Fri, 8 Nov 2024 06:24:06 +0100 Message-ID: <2024110806-CVE-2024-50175-48bf@gregkh> X-Mailer: git-send-email 2.47.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4765; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=NVtgBYsjJ9xPTOFLRzWl0+vdeMF+87VuVu2BUtyjNfw=; b=owGbwMvMwCRo6H6F97bub03G02pJDOm6C8qseVjmmRieLYlo/m33dGFGefPrhXnSty+wKi0p5 plmbC3eEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABOpameYH+fF8Il54xrB52Hp Oh/OTDWP3vD2PsM887j4/auqK2/xWQlY1jzWf5bElOYLAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: media: qcom: camss: Remove use_count guard in stop_streaming The use_count check was introduced so that multiple concurrent Raw Data Interfaces RDIs could be driven by different virtual channels VCs on the CSIPHY input driving the video pipeline. This is an invalid use of use_count though as use_count pertains to the number of times a video entity has been opened by user-space not the number of active streams. If use_count and stream-on count don't agree then stop_streaming() will break as is currently the case and has become apparent when using CAMSS with libcamera's released softisp 0.3. The use of use_count like this is a bit hacky and right now breaks regular usage of CAMSS for a single stream case. Stopping qcam results in the splat below, and then it cannot be started again and any attempts to do so fails with -EBUSY. [ 1265.509831] WARNING: CPU: 5 PID: 919 at drivers/media/common/videobuf2/videobuf2-core.c:2183 __vb2_queue_cancel+0x230/0x2c8 [videobuf2_common] ... [ 1265.510630] Call trace: [ 1265.510636] __vb2_queue_cancel+0x230/0x2c8 [videobuf2_common] [ 1265.510648] vb2_core_streamoff+0x24/0xcc [videobuf2_common] [ 1265.510660] vb2_ioctl_streamoff+0x5c/0xa8 [videobuf2_v4l2] [ 1265.510673] v4l_streamoff+0x24/0x30 [videodev] [ 1265.510707] __video_do_ioctl+0x190/0x3f4 [videodev] [ 1265.510732] video_usercopy+0x304/0x8c4 [videodev] [ 1265.510757] video_ioctl2+0x18/0x34 [videodev] [ 1265.510782] v4l2_ioctl+0x40/0x60 [videodev] ... [ 1265.510944] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 0 in active state [ 1265.511175] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 1 in active state [ 1265.511398] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 2 in active st One CAMSS specific way to handle multiple VCs on the same RDI might be: - Reference count each pipeline enable for CSIPHY, CSID, VFE and RDIx. - The video buffers are already associated with msm_vfeN_rdiX so release video buffers when told to do so by stop_streaming. - Only release the power-domains for the CSIPHY, CSID and VFE when their internal refcounts drop. Either way refusing to release video buffers based on use_count is erroneous and should be reverted. The silicon enabling code for selecting VCs is perfectly fine. Its a "known missing feature" that concurrent VCs won't work with CAMSS right now. Initial testing with this code didn't show an error but, SoftISP and "real" usage with Google Hangouts breaks the upstream code pretty quickly, we need to do a partial revert and take another pass at VCs. This commit partially reverts commit 89013969e232 ("media: camss: sm8250: Pipeline starting and stopping for multiple virtual channels") The Linux kernel CVE team has assigned CVE-2024-50175 to this issue. Affected and fixed versions =========================== Issue introduced in 6.4 with commit 89013969e232 and fixed in 6.6.55 with commit c2218a82f795 Issue introduced in 6.4 with commit 89013969e232 and fixed in 6.10.14 with commit a975db8aea15 Issue introduced in 6.4 with commit 89013969e232 and fixed in 6.11.3 with commit d7d4dde3dece Issue introduced in 6.4 with commit 89013969e232 and fixed in 6.12-rc1 with commit 25f18cb1b673 Please see https://www.kernel.org for 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-2024-50175 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/media/platform/qcom/camss/camss-video.c 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/c2218a82f795dc3d0b6210bcaa3d9c5ca736fcd9 https://git.kernel.org/stable/c/a975db8aea152f9907aa53a7f517e557ccb40da3 https://git.kernel.org/stable/c/d7d4dde3decef1b5aa1f5c390147f79aae412dee https://git.kernel.org/stable/c/25f18cb1b673220b76a86ebef8e7fb79bd303b27