# CVE-2021-47178: scsi: target: core: Avoid smp\_processor\_id() in preemptible code

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.5
- **CVSS:** 7.5 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.58% (percentile 42, 2026-11-26)
- **CWE:** CWE-459
- **Published:** 2024-03-25T09:16:28.024Z
- **Modified:** 2026-08-05T08:46:30.525Z

## Who should check

- Anyone running Linux \>= 008b936bbde3e87a611b3828a0d5d2a4f99026a0, \< a222d2794c53f8165de20aa91b39e35e4b72bce9; \>= 1526d9f10c6184031e42afad0adbdde1213e8ad1, \< a20b6eaf4f35046a429cde57bee7eb5f13d6857f; \>= 1526d9f10c6184031e42afad0adbdde1213e8ad1, \< 70ca3c57ff914113f681e657634f7fbfa68e1ad1
- Anyone running Linux 5.11

## Description

In the Linux kernel, the following vulnerability has been resolved:

scsi: target: core: Avoid smp\_processor\_id() in preemptible code

The BUG message "BUG: using smp\_processor\_id() in preemptible \[00000000\]
code" was observed for TCMU devices with kernel config DEBUG\_PREEMPT.

The message was observed when blktests block/005 was run on TCMU devices
with fileio backend or user:zbc backend \[1\]. The commit 1130b499b4a7
("scsi: target: tcm\_loop: Use LIO wq cmd submission helper") triggered the
symptom. The commit modified work queue to handle commands and changed
'current-\>nr\_cpu\_allowed' at smp\_processor\_id() call.

The message was also observed at system shutdown when TCMU devices were not
cleaned up \[2\]. The function smp\_processor\_id() was called in SCSI host
work queue for abort handling, and triggered the BUG message. This symptom
was observed regardless of the commit 1130b499b4a7 ("scsi: target:
tcm\_loop: Use LIO wq cmd submission helper").

To avoid the preemptible code check at smp\_processor\_id(), get CPU ID with
raw\_smp\_processor\_id() instead. The CPU ID is used for performance
improvement then thread move to other CPU will not affect the code.

\[1\]

\[   56.468103\] run blktests block/005 at 2021-05-12 14:16:38
\[   57.369473\] check\_preemption\_disabled: 85 callbacks suppressed
\[   57.369480\] BUG: using smp\_processor\_id() in preemptible \[00000000\] code: fio/1511
\[   57.369506\] BUG: using smp\_processor\_id() in preemptible \[00000000\] code: fio/1510
\[   57.369512\] BUG: using smp\_processor\_id() in preemptible \[00000000\] code: fio/1506
\[   57.369552\] caller is \_\_target\_init\_cmd+0x157/0x170 \[target\_core\_mod\]
\[   57.369606\] CPU: 4 PID: 1506 Comm: fio Not tainted 5.13.0-rc1+ \#34
\[   57.369613\] Hardware name: System manufacturer System Product Name/PRIME Z270-A, BIOS 1302 03/15/2018
\[   57.369617\] Call Trace:
\[   57.369621\] BUG: using smp\_processor\_id() in preemptible \[00000000\] code: fio/1507
\[   57.369628\]  dump\_stack+0x6d/0x89
\[   57.369642\]  check\_preemption\_disabled+0xc8/0xd0
\[   57.369628\] caller is \_\_target\_init\_cmd+0x157/0x170 \[target\_core\_mod\]
\[   57.369655\]  \_\_target\_init\_cmd+0x157/0x170 \[target\_core\_mod\]
\[   57.369695\]  target\_init\_cmd+0x76/0x90 \[target\_core\_mod\]
\[   57.369732\]  tcm\_loop\_queuecommand+0x109/0x210 \[tcm\_loop\]
\[   57.369744\]  scsi\_queue\_rq+0x38e/0xc40
\[   57.369761\]  \_\_blk\_mq\_try\_issue\_directly+0x109/0x1c0
\[   57.369779\]  blk\_mq\_try\_issue\_directly+0x43/0x90
\[   57.369790\]  blk\_mq\_submit\_bio+0x4e5/0x5d0
\[   57.369812\]  submit\_bio\_noacct+0x46e/0x4e0
\[   57.369830\]  \_\_blkdev\_direct\_IO\_simple+0x1a3/0x2d0
\[   57.369859\]  ? set\_init\_blocksize.isra.0+0x60/0x60
\[   57.369880\]  generic\_file\_read\_iter+0x89/0x160
\[   57.369898\]  blkdev\_read\_iter+0x44/0x60
\[   57.369906\]  new\_sync\_read+0x102/0x170
\[   57.369929\]  vfs\_read+0xd4/0x160
\[   57.369941\]  \_\_x64\_sys\_pread64+0x6e/0xa0
\[   57.369946\]  ? lockdep\_hardirqs\_on+0x79/0x100
\[   57.369958\]  do\_syscall\_64+0x3a/0x70
\[   57.369965\]  entry\_SYSCALL\_64\_after\_hwframe+0x44/0xae
\[   57.369973\] RIP: 0033:0x7f7ed4c1399f
\[   57.369979\] Code: 08 89 3c 24 48 89 4c 24 18 e8 7d f3 ff ff 4c 8b 54 24 18 48 8b 54 24 10 41 89 c0 48 8b 74 24 08 8b 3c 24 b8 11 00 00 00 0f 05 \<48\> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 04 24 e8 cd f3 ff ff 48 8b
\[   57.369983\] RSP: 002b:00007ffd7918c580 EFLAGS: 00000293 ORIG\_RAX: 0000000000000011
\[   57.369990\] RAX: ffffffffffffffda RBX: 00000000015b4540 RCX: 00007f7ed4c1399f
\[   57.369993\] RDX: 0000000000001000 RSI: 00000000015de000 RDI: 0000000000000009
\[   57.369996\] RBP: 00000000015b4540 R08: 0000000000000000 R09: 0000000000000001
\[   57.369999\] R10: 0000000000e5c000 R11: 0000000000000293 R12: 00007f7eb5269a70
\[   57.370002\] R13: 0000000000000000 R14: 0000000000001000 R15: 00000000015b4568
\[   57.370031\] CPU: 7 PID: 1507 Comm: fio Not tainted 5.13.0-rc1+ \#34
\[   57.370036\] Hardware name: System manufacturer System Product Name/PRIME Z270-A, BIOS 1302 03/15/2018
\[   57.370039\] Call Trace:
\[   57.370045\]  dump\_stack+0x6d/0x89
\[   57.370056\]  ch
---truncated---

## Affected and fixed versions

- Linux: \>= 008b936bbde3e87a611b3828a0d5d2a4f99026a0, \< a222d2794c53f8165de20aa91b39e35e4b72bce9; \>= 1526d9f10c6184031e42afad0adbdde1213e8ad1, \< a20b6eaf4f35046a429cde57bee7eb5f13d6857f; \>= 1526d9f10c6184031e42afad0adbdde1213e8ad1, \< 70ca3c57ff914113f681e657634f7fbfa68e1ad1 (cvelist)
- Linux: 5.11 (cvelist)

## Mitigation

- Upgrade Linux to 70ca3c57ff914113f681e657634f7fbfa68e1ad1 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2021-47178. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-47178.md
Affected: Linux >= 008b936bbde3e87a611b3828a0d5d2a4f99026a0, < a222d2794c53f8165de20aa91b39e35e4b72bce9; >= 1526d9f10c6184031e42afad0adbdde1213e8ad1, < a20b6eaf4f35046a429cde57bee7eb5f13d6857f; >= 1526d9f10c6184031e42afad0adbdde1213e8ad1, < 70ca3c57ff914113f681e657634f7fbfa68e1ad1; Linux 5.11
Fixed in: Linux 70ca3c57ff914113f681e657634f7fbfa68e1ad1

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2021-47178 being exploited?

There is no confirmed exploitation: CVE-2021-47178 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.58% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2021-47178?

High: CVSS 7.5 (v3.1, scored by CNA). Remote, no login needed.

### Which versions are affected by CVE-2021-47178?

Linux \>= 008b936bbde3e87a611b3828a0d5d2a4f99026a0, \< a222d2794c53f8165de20aa91b39e35e4b72bce9; \>= 1526d9f10c6184031e42afad0adbdde1213e8ad1, \< a20b6eaf4f35046a429cde57bee7eb5f13d6857f; \>= 1526d9f10c6184031e42afad0adbdde1213e8ad1, \< 70ca3c57ff914113f681e657634f7fbfa68e1ad1; Linux 5.11.

### Is there a fix for CVE-2021-47178?

Yes. Fixed in Linux 70ca3c57ff914113f681e657634f7fbfa68e1ad1. Upgrade Linux to 70ca3c57ff914113f681e657634f7fbfa68e1ad1 or later.

### How do I check if I'm affected by CVE-2021-47178?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/a222d2794c53f8165de20aa91b39e35e4b72bce9>
- patch: <https://git.kernel.org/stable/c/a20b6eaf4f35046a429cde57bee7eb5f13d6857f>
- patch: <https://git.kernel.org/stable/c/70ca3c57ff914113f681e657634f7fbfa68e1ad1>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2021-47178>

HTML: <https://flawdb.com/CVE-2021-47178> · JSON: <https://flawdb.com/api/v1/entries/CVE-2021-47178>
