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 AD19F15B103 for ; Mon, 29 Jul 2024 14:34:22 +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=1722263662; cv=none; b=CYrcG+vAW45BjgRn1prZcHkvvHKQBcm2xEPp3WVg6rT4vjqYOGoKaosZ2NLoUa7JV/VY4zxYkepRfdiJPPCGpP7v4f0fXxJ8DdltNCYgTHBkS8/fakBE9M6+JghHAe9q2ixDzoilCMt/fGZs8ho7UZvSLxvya6MyoZWpwYVbGQA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722263662; c=relaxed/simple; bh=XE+agoGfQJ8X+2D8aYCnGINpQiUPjtEz9iDC9In4cwQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=jeVH40uQJyRniT//KPVF8vA3Qknazlo/986+AFflstcMIjzfirupVgsSlYivhbKdyaktvbAVwvQDP5Jmz8IiGuepuNJT4Y1p7KlQcKwBjGjR7FrmOEGYupV4xSI476WqTzEcDzef2NYsVmcA9wgvpqOkJmYzBNcViES2K5JRhc4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mSBW+HI/; 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="mSBW+HI/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D2E7C32786; Mon, 29 Jul 2024 14:34:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722263662; bh=XE+agoGfQJ8X+2D8aYCnGINpQiUPjtEz9iDC9In4cwQ=; h=From:To:Cc:Subject:Date:Reply-to:From; b=mSBW+HI/NM45grgo2csiAVrb+ClxVU8zTSo4Leif3N8J0vaH7g8EMRaDRXEMxMALO lYNTCkPuG/UCiJM3pyRN42JhVjoOiKAnihgNG3apmzXQjtko4FTldEA8rdJNLK03wD D8hdqida6ocrHFcrJDqkyNEOA4CWHpcHH+LUOtJk= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-41053: scsi: ufs: core: Fix ufshcd_abort_one racing issue Date: Mon, 29 Jul 2024 16:32:48 +0200 Message-ID: <2024072928-CVE-2024-41053-e8e4@gregkh> X-Mailer: git-send-email 2.45.2 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=3168; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=XE+agoGfQJ8X+2D8aYCnGINpQiUPjtEz9iDC9In4cwQ=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnLl/9RlwzKty6qjtGW7l209NqzmeULd0htMvu0aJL7y nkffzF+7ohlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJGBxiWLDpbrhV1ee82rtV D3aILZY7mHQgci7Dgob5p8qP3gl5eupS8cbgwAdMt2akXwAA 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: scsi: ufs: core: Fix ufshcd_abort_one racing issue When ufshcd_abort_one is racing with the completion ISR, the completed tag of the request's mq_hctx pointer will be set to NULL by ISR. Return success when request is completed by ISR because ufshcd_abort_one does not need to do anything. The racing flow is: Thread A ufshcd_err_handler step 1 ... ufshcd_abort_one ufshcd_try_to_abort_task ufshcd_cmd_inflight(true) step 3 ufshcd_mcq_req_to_hwq blk_mq_unique_tag rq->mq_hctx->queue_num step 5 Thread B ufs_mtk_mcq_intr(cq complete ISR) step 2 scsi_done ... __blk_mq_free_request rq->mq_hctx = NULL; step 4 Below is KE back trace. ufshcd_try_to_abort_task: cmd at tag 41 not pending in the device. ufshcd_try_to_abort_task: cmd at tag=41 is cleared. Aborting tag 41 / CDB 0x28 succeeded Unable to handle kernel NULL pointer dereference at virtual address 0000000000000194 pc : [0xffffffddd7a79bf8] blk_mq_unique_tag+0x8/0x14 lr : [0xffffffddd6155b84] ufshcd_mcq_req_to_hwq+0x1c/0x40 [ufs_mediatek_mod_ise] do_mem_abort+0x58/0x118 el1_abort+0x3c/0x5c el1h_64_sync_handler+0x54/0x90 el1h_64_sync+0x68/0x6c blk_mq_unique_tag+0x8/0x14 ufshcd_err_handler+0xae4/0xfa8 [ufs_mediatek_mod_ise] process_one_work+0x208/0x4fc worker_thread+0x228/0x438 kthread+0x104/0x1d4 ret_from_fork+0x10/0x20 The Linux kernel CVE team has assigned CVE-2024-41053 to this issue. Affected and fixed versions =========================== Issue introduced in 6.6.5 with commit ff7699d36207 and fixed in 6.6.41 with commit c3111b3cf388 Issue introduced in 6.7 with commit 93e6c0e19d5b and fixed in 6.9.10 with commit b5a6ac887256 Issue introduced in 6.7 with commit 93e6c0e19d5b and fixed in 6.10 with commit 74736103fb41 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-41053 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/ufs/core/ufshcd.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/c3111b3cf3889bfa7b73ebff83d7397db9b7e5e0 https://git.kernel.org/stable/c/b5a6ac887256762758bfe7f2918cb0233aa544f4 https://git.kernel.org/stable/c/74736103fb4123c71bf11fb7a6abe7c884c5269e