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 114686D1D2 for ; Tue, 21 May 2024 14:37:58 +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=1716302278; cv=none; b=LqzLrW3NbmjRQ9yr8ZoJX4im40wOKUZJwzctjFE/0g3W5bGomqojpUum2N+yc5BEmZR2g8EwR4dmGWMWCp4rHp+/AFa85luF/ATrw5hqCMegJQlDdFEVV2TzM+ofCt5n9PfULhxbad9sm4ZoRQzgQuUF8sP0gvkV7m7UOx8hkK0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716302278; c=relaxed/simple; bh=ybwI0vVMAkMpGoiYp1NKsgRanYgauiBWQcNOEDDd62g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SufNBnFY1EuWFILUES8IO/oaNLS4XKaZSwgqghOA45aDrrHXuwTntlxbT11a7vCqlLHXHddMkxDK6F3w9AaHc9HaWIbq2c76RYtkvUbXO4l92D9JpkKBG1lFKr90Sa6010gT2sN7T2fABsE6M1BnJQTqWkP27j2LfuMhsESLdFQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XvAsm7w/; 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="XvAsm7w/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D270C2BD11; Tue, 21 May 2024 14:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716302277; bh=ybwI0vVMAkMpGoiYp1NKsgRanYgauiBWQcNOEDDd62g=; h=From:To:Cc:Subject:Date:Reply-to:From; b=XvAsm7w/IJCAgInoXmuLwywJh2mclXbdjnAMQDfISyNv77cpqYM1d1avzekc8TPxr mGmMEBVdlLWoTIPgupVAJAgiqafrinbp0wA26FVh3LZTccacgS+KDwiwh9SIR1Bf8D STNnnKm0MhvP1Rp59zl5pFOtjxCFh3vjjLyHzJxg= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47290: scsi: target: Fix NULL dereference on XCOPY completion Date: Tue, 21 May 2024 16:35:24 +0200 Message-ID: <2024052122-CVE-2021-47290-b403@gregkh> X-Mailer: git-send-email 2.45.1 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=3063; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ybwI0vVMAkMpGoiYp1NKsgRanYgauiBWQcNOEDDd62g=; b=owGbwMvMwCRo6H6F97bub03G02pJDGk+G7VaQ4LmL+Ko7ll5Pats6+6M80lb+EP+xFjnFL1r2 r/9PNuKjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIqTUMc/jmFc3sPBj23WL6 T3ObiskZfKvn+DDML/NXOLSxqHbm2XunM8RXz9R/drxiPwA= 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: target: Fix NULL dereference on XCOPY completion CPU affinity control added with commit 39ae3edda325 ("scsi: target: core: Make completion affinity configurable") makes target_complete_cmd() queue work on a CPU based on se_tpg->se_tpg_wwn->cmd_compl_affinity state. LIO's EXTENDED COPY worker is a special case in that read/write cmds are dispatched using the global xcopy_pt_tpg, which carries a NULL se_tpg_wwn pointer following initialization in target_xcopy_setup_pt(). The NULL xcopy_pt_tpg->se_tpg_wwn pointer is dereferenced on completion of any EXTENDED COPY initiated read/write cmds. E.g using the libiscsi SCSI.ExtendedCopy.Simple test: BUG: kernel NULL pointer dereference, address: 00000000000001a8 RIP: 0010:target_complete_cmd+0x9d/0x130 [target_core_mod] Call Trace: fd_execute_rw+0x148/0x42a [target_core_file] ? __dynamic_pr_debug+0xa7/0xe0 ? target_check_reservation+0x5b/0x940 [target_core_mod] __target_execute_cmd+0x1e/0x90 [target_core_mod] transport_generic_new_cmd+0x17c/0x330 [target_core_mod] target_xcopy_issue_pt_cmd+0x9/0x60 [target_core_mod] target_xcopy_read_source.isra.7+0x10b/0x1b0 [target_core_mod] ? target_check_fua+0x40/0x40 [target_core_mod] ? transport_complete_task_attr+0x130/0x130 [target_core_mod] target_xcopy_do_work+0x61f/0xc00 [target_core_mod] This fix makes target_complete_cmd() queue work on se_cmd->cpuid if se_tpg_wwn is NULL. The Linux kernel CVE team has assigned CVE-2021-47290 to this issue. Affected and fixed versions =========================== Issue introduced in 5.13 with commit 39ae3edda325 and fixed in 5.13.6 with commit e7732c5a19a1 Issue introduced in 5.13 with commit 39ae3edda325 and fixed in 5.14 with commit a47fa41381a0 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-2021-47290 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/target/target_core_transport.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/e7732c5a19a15a62b0b23fd683a639b0483e1f40 https://git.kernel.org/stable/c/a47fa41381a09e5997afd762664db4f5f6657e03