# CVE-2021-47337: scsi: core: Fix bad pointer dereference when ehandler kthread is invalid

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

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; 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:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.31% (percentile 16, 2026-11-26)
- **CWE:** CWE-476
- **Published:** 2024-05-21T14:35:46.379Z
- **Modified:** 2026-06-17T04:17:13.763Z

## Who should check

- Anyone running Linux \>= 8958181c1663e24a13434448e7d6b96b5d04900a, \< d2f0b960d07e52bb664471b4de0ed8b08c636b3a; \>= db08ce595dd64ea9859f7d088b51cbfc8e685c66, \< f3d0a109240c9bed5c60d819014786be3a2fe515; \>= 2dc85045ae65b9302a1d2e2ddd7ce4c030153a6a, \< e1bd3fac2baa3d5c04375980c1d5263a3335af92; \>= 79296e292d67fa7b5fb8d8c27343683e823872c8, \< 887bfae2732b5b02a86a859fd239d34f7ff93c05; \>= 7a696ce1d5d16a33a6cd6400bbcc0339b2460e11, \< ea518b70ed5e4598c8d706f37fc16f7b06e440bd; \>= 45d83db4728127944b237c0c8248987df9d478e7, \< 8e4212ecf0713dd57d0e3209a66201da582149b1; \>= 66a834d092930cf41d809c0e989b13cd6f9ca006, \< c1671d2d2ef8a84837eea1b4d99ca0c6a66fb691; \>= 66a834d092930cf41d809c0e989b13cd6f9ca006, \< 93aa71ad7379900e61c8adff6a710a4c18c7c99b; \>= 4.9.273, \< 4.9.276; \>= 4.14.237, \< 4.14.240; …
- Anyone running Linux 5.13

## Description

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

scsi: core: Fix bad pointer dereference when ehandler kthread is invalid

Commit 66a834d09293 ("scsi: core: Fix error handling of scsi\_host\_alloc()")
changed the allocation logic to call put\_device() to perform host cleanup
with the assumption that IDA removal and stopping the kthread would
properly be performed in scsi\_host\_dev\_release(). However, in the unlikely
case that the error handler thread fails to spawn, shost-\>ehandler is set
to ERR\_PTR(-ENOMEM).

The error handler cleanup code in scsi\_host\_dev\_release() will call
kthread\_stop() if shost-\>ehandler != NULL which will always be the case
whether the kthread was successfully spawned or not. In the case that it
failed to spawn this has the nasty side effect of trying to dereference an
invalid pointer when kthread\_stop() is called. The following splat provides
an example of this behavior in the wild:

scsi host11: error handler thread failed to spawn, error = -4
Kernel attempted to read user page (10c) - exploit attempt? (uid: 0)
BUG: Kernel NULL pointer dereference on read at 0x0000010c
Faulting instruction address: 0xc00000000818e9a8
Oops: Kernel access of bad area, sig: 11 \[\#1\]
LE PAGE\_SIZE=64K MMU=Hash SMP NR\_CPUS=2048 NUMA pSeries
Modules linked in: ibmvscsi(+) scsi\_transport\_srp dm\_multipath dm\_mirror dm\_region
 hash dm\_log dm\_mod fuse overlay squashfs loop
CPU: 12 PID: 274 Comm: systemd-udevd Not tainted 5.13.0-rc7 \#1
NIP:  c00000000818e9a8 LR: c0000000089846e8 CTR: 0000000000007ee8
REGS: c000000037d12ea0 TRAP: 0300   Not tainted  (5.13.0-rc7)
MSR:  800000000280b033 &lt;SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE&gt;  CR: 28228228
XER: 20040001
CFAR: c0000000089846e4 DAR: 000000000000010c DSISR: 40000000 IRQMASK: 0
GPR00: c0000000089846e8 c000000037d13140 c000000009cc1100 fffffffffffffffc
GPR04: 0000000000000001 0000000000000000 0000000000000000 c000000037dc0000
GPR08: 0000000000000000 c000000037dc0000 0000000000000001 00000000fffff7ff
GPR12: 0000000000008000 c00000000a049000 c000000037d13d00 000000011134d5a0
GPR16: 0000000000001740 c0080000190d0000 c0080000190d1740 c000000009129288
GPR20: c000000037d13bc0 0000000000000001 c000000037d13bc0 c0080000190b7898
GPR24: c0080000190b7708 0000000000000000 c000000033bb2c48 0000000000000000
GPR28: c000000046b28280 0000000000000000 000000000000010c fffffffffffffffc
NIP \[c00000000818e9a8\] kthread\_stop+0x38/0x230
LR \[c0000000089846e8\] scsi\_host\_dev\_release+0x98/0x160
Call Trace:
\[c000000033bb2c48\] 0xc000000033bb2c48 (unreliable)
\[c0000000089846e8\] scsi\_host\_dev\_release+0x98/0x160
\[c00000000891e960\] device\_release+0x60/0x100
\[c0000000087e55c4\] kobject\_release+0x84/0x210
\[c00000000891ec78\] put\_device+0x28/0x40
\[c000000008984ea4\] scsi\_host\_alloc+0x314/0x430
\[c0080000190b38bc\] ibmvscsi\_probe+0x54/0xad0 \[ibmvscsi\]
\[c000000008110104\] vio\_bus\_probe+0xa4/0x4b0
\[c00000000892a860\] really\_probe+0x140/0x680
\[c00000000892aefc\] driver\_probe\_device+0x15c/0x200
\[c00000000892b63c\] device\_driver\_attach+0xcc/0xe0
\[c00000000892b740\] \_\_driver\_attach+0xf0/0x200
\[c000000008926f28\] bus\_for\_each\_dev+0xa8/0x130
\[c000000008929ce4\] driver\_attach+0x34/0x50
\[c000000008928fc0\] bus\_add\_driver+0x1b0/0x300
\[c00000000892c798\] driver\_register+0x98/0x1a0
\[c00000000810eb60\] \_\_vio\_register\_driver+0x80/0xe0
\[c0080000190b4a30\] ibmvscsi\_module\_init+0x9c/0xdc \[ibmvscsi\]
\[c0000000080121d0\] do\_one\_initcall+0x60/0x2d0
\[c000000008261abc\] do\_init\_module+0x7c/0x320
\[c000000008265700\] load\_module+0x2350/0x25b0
\[c000000008265cb4\] \_\_do\_sys\_finit\_module+0xd4/0x160
\[c000000008031110\] system\_call\_exception+0x150/0x2d0
\[c00000000800d35c\] system\_call\_common+0xec/0x278

Fix this be nulling shost-\>ehandler when the kthread fails to spawn.

## Affected and fixed versions

- Linux: \>= 8958181c1663e24a13434448e7d6b96b5d04900a, \< d2f0b960d07e52bb664471b4de0ed8b08c636b3a; \>= db08ce595dd64ea9859f7d088b51cbfc8e685c66, \< f3d0a109240c9bed5c60d819014786be3a2fe515; \>= 2dc85045ae65b9302a1d2e2ddd7ce4c030153a6a, \< e1bd3fac2baa3d5c04375980c1d5263a3335af92; \>= 79296e292d67fa7b5fb8d8c27343683e823872c8, \< 887bfae2732b5b02a86a859fd239d34f7ff93c05; \>= 7a696ce1d5d16a33a6cd6400bbcc0339b2460e11, \< ea518b70ed5e4598c8d706f37fc16f7b06e440bd; \>= 45d83db4728127944b237c0c8248987df9d478e7, \< 8e4212ecf0713dd57d0e3209a66201da582149b1; \>= 66a834d092930cf41d809c0e989b13cd6f9ca006, \< c1671d2d2ef8a84837eea1b4d99ca0c6a66fb691; \>= 66a834d092930cf41d809c0e989b13cd6f9ca006, \< 93aa71ad7379900e61c8adff6a710a4c18c7c99b; \>= 4.9.273, \< 4.9.276; \>= 4.14.237, \< 4.14.240; … (cvelist)
- Linux: 5.13 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2021-47337.md
Affected: Linux >= 8958181c1663e24a13434448e7d6b96b5d04900a, < d2f0b960d07e52bb664471b4de0ed8b08c636b3a; >= db08ce595dd64ea9859f7d088b51cbfc8e685c66, < f3d0a109240c9bed5c60d819014786be3a2fe515; >= 2dc85045ae65b9302a1d2e2ddd7ce4c030153a6a, < e1bd3fac2baa3d5c04375980c1d5263a3335af92; >= 79296e292d67fa7b5fb8d8c…
Fixed in: Linux 887bfae2732b5b02a86a859fd239d34f7ff93c05, Linux 8e4212ecf0713dd57d0e3209a66201da582149b1, Linux 93aa71ad7379900e61c8adff6a710a4c18c7c99b, Linux 4.9.276, Linux 4.14.240

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-47337 being exploited?

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

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

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

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

Linux \>= 8958181c1663e24a13434448e7d6b96b5d04900a, \< d2f0b960d07e52bb664471b4de0ed8b08c636b3a; \>= db08ce595dd64ea9859f7d088b51cbfc8e685c66, \< f3d0a109240c9bed5c60d819014786be3a2fe515; \>= 2dc85045ae65b9302a1d2e2ddd7ce4c030153a6a, \< e1bd3fac2baa3d5c04375980c1d5263a3335af92; \>= 79296e292d67fa7b5fb8d8c27343683e823872c8, \< 887bfae2732b5b02a86a859fd239d34f7ff93c05; \>= 7a696ce1d5d16a33a6cd6400bbcc0339b2460e11, \< ea518b70ed5e4598c8d706f37fc16f7b06e440bd; \>= 45d83db4728127944b237c0c8248987df9d478e7, \< 8e4212ecf0713dd57d0e3209a66201da582149b1; \>= 66a834d092930cf41d809c0e989b13cd6f9ca006, \< c1671d2d2ef8a84837eea1b4d99ca0c6a66fb691; \>= 66a834d092930cf41d809c0e989b13cd6f9ca006, \< 93aa71ad7379900e61c8adff6a710a4c18c7c99b; \>= 4.9.273, \< 4.9.276; \>= 4.14.237, \< 4.14.240; …; Linux 5.13.

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

Yes. Fixed in Linux 887bfae2732b5b02a86a859fd239d34f7ff93c05, Linux 8e4212ecf0713dd57d0e3209a66201da582149b1, Linux 93aa71ad7379900e61c8adff6a710a4c18c7c99b, Linux 4.9.276, Linux 4.14.240. No fix listed yet: follow the vendor advisory.

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

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/d2f0b960d07e52bb664471b4de0ed8b08c636b3a>
- patch: <https://git.kernel.org/stable/c/f3d0a109240c9bed5c60d819014786be3a2fe515>
- patch: <https://git.kernel.org/stable/c/e1bd3fac2baa3d5c04375980c1d5263a3335af92>
- patch: <https://git.kernel.org/stable/c/887bfae2732b5b02a86a859fd239d34f7ff93c05>
- patch: <https://git.kernel.org/stable/c/ea518b70ed5e4598c8d706f37fc16f7b06e440bd>
- patch: <https://git.kernel.org/stable/c/8e4212ecf0713dd57d0e3209a66201da582149b1>
- patch: <https://git.kernel.org/stable/c/c1671d2d2ef8a84837eea1b4d99ca0c6a66fb691>
- patch: <https://git.kernel.org/stable/c/93aa71ad7379900e61c8adff6a710a4c18c7c99b>

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

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