# CVE-2021-47290: scsi: target: Fix NULL dereference on XCOPY completion

- Severity: High 7.5 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.46%, higher than 41% of CVEs (2026-12-01)
- Published: 2024-05-21T14:35:15.411Z
- Modified: 2026-08-05T08:47:06.047Z
- Weaknesses: CWE-476
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## 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.

(As written by CVE List.)

## Affected

- Linux Linux: from 39ae3edda325e9cf9e978c9788affe88231f3b34 before e7732c5a19a15a62b0b23fd683a639b0483e1f40; from 39ae3edda325e9cf9e978c9788affe88231f3b34 before a47fa41381a09e5997afd762664db4f5f6657e03; 5.13 (not affected: before 5.13; from 5.13.6 up to 5.13.*; from 5.14 up to *)
- linux linux_kernel: from 5.13 before 5.13.6; 5.14

## Every score

- Linux: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- NVD: CVSS:3.1 5.5 Medium `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`

## References

- <https://git.kernel.org/stable/c/e7732c5a19a15a62b0b23fd683a639b0483e1f40> (patch)
- <https://git.kernel.org/stable/c/a47fa41381a09e5997afd762664db4f5f6657e03> (patch)

## Sources

- CVE List: [CVE-2021-47290](https://www.cve.org/CVERecord?id=CVE-2021-47290), CVE Terms of Use, modified 2026-08-05
- NVD: [CVE-2021-47290](https://nvd.nist.gov/vuln/detail/CVE-2021-47290), Public domain, modified 2026-08-04

---

Page: https://cve.day/CVE-2021-47290 · Whole record: https://cve.day/CVE-2021-47290.json · Rebuilt by cve.day 2026-11-25T22:58:08.779Z
