# CVE-2021-47041: nvmet-tcp: fix incorrect locking in state\_change sk callback

> 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.49% (percentile 35, 2026-11-26)
- **CWE:** CWE-667
- **Published:** 2024-02-28T08:13:47.182Z
- **Modified:** 2026-08-05T08:45:42.051Z

## Who should check

- Anyone running Linux \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 999d606a820c36ae9b9e9611360c8b3d8d4bb777; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 60ade0d56b06537a28884745059b3801c78e03bc; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 06beaa1a9f6e501213195e47c30416032fd2bbd5; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 906c538340dde6d891df89fe7dac8eaa724e40da; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< b5332a9f3f3d884a1b646ce155e664cc558c1722
- Anyone running Linux 5.0

## Description

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

nvmet-tcp: fix incorrect locking in state\_change sk callback

We are not changing anything in the TCP connection state so
we should not take a write\_lock but rather a read lock.

This caused a deadlock when running nvmet-tcp and nvme-tcp
on the same system, where state\_change callbacks on the
host and on the controller side have causal relationship
and made lockdep report on this with blktests:

================================
WARNING: inconsistent lock state
5.12.0-rc3 \#1 Tainted: G          I
--------------------------------
inconsistent {IN-SOFTIRQ-W} -\> {SOFTIRQ-ON-R} usage.
nvme/1324 \[HC0\[0\]:SC0\[0\]:HE1:SE1\] takes:
ffff888363151000 (clock-AF\_INET){++-?}-{2:2}, at: nvme\_tcp\_state\_change+0x21/0x150 \[nvme\_tcp\]
{IN-SOFTIRQ-W} state was registered at:
  \_\_lock\_acquire+0x79b/0x18d0
  lock\_acquire+0x1ca/0x480
  \_raw\_write\_lock\_bh+0x39/0x80
  nvmet\_tcp\_state\_change+0x21/0x170 \[nvmet\_tcp\]
  tcp\_fin+0x2a8/0x780
  tcp\_data\_queue+0xf94/0x1f20
  tcp\_rcv\_established+0x6ba/0x1f00
  tcp\_v4\_do\_rcv+0x502/0x760
  tcp\_v4\_rcv+0x257e/0x3430
  ip\_protocol\_deliver\_rcu+0x69/0x6a0
  ip\_local\_deliver\_finish+0x1e2/0x2f0
  ip\_local\_deliver+0x1a2/0x420
  ip\_rcv+0x4fb/0x6b0
  \_\_netif\_receive\_skb\_one\_core+0x162/0x1b0
  process\_backlog+0x1ff/0x770
  \_\_napi\_poll.constprop.0+0xa9/0x5c0
  net\_rx\_action+0x7b3/0xb30
  \_\_do\_softirq+0x1f0/0x940
  do\_softirq+0xa1/0xd0
  \_\_local\_bh\_enable\_ip+0xd8/0x100
  ip\_finish\_output2+0x6b7/0x18a0
  \_\_ip\_queue\_xmit+0x706/0x1aa0
  \_\_tcp\_transmit\_skb+0x2068/0x2e20
  tcp\_write\_xmit+0xc9e/0x2bb0
  \_\_tcp\_push\_pending\_frames+0x92/0x310
  inet\_shutdown+0x158/0x300
  \_\_nvme\_tcp\_stop\_queue+0x36/0x270 \[nvme\_tcp\]
  nvme\_tcp\_stop\_queue+0x87/0xb0 \[nvme\_tcp\]
  nvme\_tcp\_teardown\_admin\_queue+0x69/0xe0 \[nvme\_tcp\]
  nvme\_do\_delete\_ctrl+0x100/0x10c \[nvme\_core\]
  nvme\_sysfs\_delete.cold+0x8/0xd \[nvme\_core\]
  kernfs\_fop\_write\_iter+0x2c7/0x460
  new\_sync\_write+0x36c/0x610
  vfs\_write+0x5c0/0x870
  ksys\_write+0xf9/0x1d0
  do\_syscall\_64+0x33/0x40
  entry\_SYSCALL\_64\_after\_hwframe+0x44/0xae
irq event stamp: 10687
hardirqs last  enabled at (10687): \[\<ffffffff9ec376bd\>\] \_raw\_spin\_unlock\_irqrestore+0x2d/0x40
hardirqs last disabled at (10686): \[\<ffffffff9ec374d8\>\] \_raw\_spin\_lock\_irqsave+0x68/0x90
softirqs last  enabled at (10684): \[\<ffffffff9f000608\>\] \_\_do\_softirq+0x608/0x940
softirqs last disabled at (10649): \[\<ffffffff9cdedd31\>\] do\_softirq+0xa1/0xd0

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(clock-AF\_INET);
  \<Interrupt\>
    lock(clock-AF\_INET);

 \*\*\* DEADLOCK \*\*\*

5 locks held by nvme/1324:
 \#0: ffff8884a01fe470 (sb\_writers\#4){.+.+}-{0:0}, at: ksys\_write+0xf9/0x1d0
 \#1: ffff8886e435c090 (&of-\>mutex){+.+.}-{3:3}, at: kernfs\_fop\_write\_iter+0x216/0x460
 \#2: ffff888104d90c38 (kn-\>active\#255){++++}-{0:0}, at: kernfs\_remove\_self+0x22d/0x330
 \#3: ffff8884634538d0 (&queue-\>queue\_lock){+.+.}-{3:3}, at: nvme\_tcp\_stop\_queue+0x52/0xb0 \[nvme\_tcp\]
 \#4: ffff888363150d30 (sk\_lock-AF\_INET){+.+.}-{0:0}, at: inet\_shutdown+0x59/0x300

stack backtrace:
CPU: 26 PID: 1324 Comm: nvme Tainted: G          I       5.12.0-rc3 \#1
Hardware name: Dell Inc. PowerEdge R640/06NR82, BIOS 2.10.0 11/12/2020
Call Trace:
 dump\_stack+0x93/0xc2
 mark\_lock\_irq.cold+0x2c/0xb3
 ? verify\_lock\_unused+0x390/0x390
 ? stack\_trace\_consume\_entry+0x160/0x160
 ? lock\_downgrade+0x100/0x100
 ? save\_trace+0x88/0x5e0
 ? \_raw\_spin\_unlock\_irqrestore+0x2d/0x40
 mark\_lock+0x530/0x1470
 ? mark\_lock\_irq+0x1d10/0x1d10
 ? enqueue\_timer+0x660/0x660
 mark\_usage+0x215/0x2a0
 \_\_lock\_acquire+0x79b/0x18d0
 ? tcp\_schedule\_loss\_probe.part.0+0x38c/0x520
 lock\_acquire+0x1ca/0x480
 ? nvme\_tcp\_state\_change+0x21/0x150 \[nvme\_tcp\]
 ? rcu\_read\_unlock+0x40/0x40
 ? tcp\_mtu\_probe+0x1ae0/0x1ae0
 ? kmalloc\_reserve+0xa0/0xa0
 ? sysfs\_file\_ops+0x170/0x170
 \_raw\_read\_lock+0x3d/0xa0
 ? nvme\_tcp\_state\_change+0x21/0x150 \[nvme\_tcp\]
 nvme\_tcp\_state\_change+0x21/0x150 \[nvme\_tcp\]
 ? sysfs\_file\_ops
---truncated---

## Affected and fixed versions

- Linux: \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 999d606a820c36ae9b9e9611360c8b3d8d4bb777; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 60ade0d56b06537a28884745059b3801c78e03bc; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 06beaa1a9f6e501213195e47c30416032fd2bbd5; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 906c538340dde6d891df89fe7dac8eaa724e40da; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< b5332a9f3f3d884a1b646ce155e664cc558c1722 (cvelist)
- Linux: 5.0 (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-47041. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-47041.md
Affected: Linux >= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, < 999d606a820c36ae9b9e9611360c8b3d8d4bb777; >= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, < 60ade0d56b06537a28884745059b3801c78e03bc; >= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, < 06beaa1a9f6e501213195e47c30416032fd2bbd5; >= 872d26a391da92ed8f0c0f5…
Fixed in: Linux 999d606a820c36ae9b9e9611360c8b3d8d4bb777, Linux 60ade0d56b06537a28884745059b3801c78e03bc, Linux 06beaa1a9f6e501213195e47c30416032fd2bbd5, Linux 906c538340dde6d891df89fe7dac8eaa724e40da

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

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

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

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

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

Linux \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 999d606a820c36ae9b9e9611360c8b3d8d4bb777; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 60ade0d56b06537a28884745059b3801c78e03bc; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 06beaa1a9f6e501213195e47c30416032fd2bbd5; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< 906c538340dde6d891df89fe7dac8eaa724e40da; \>= 872d26a391da92ed8f0c0f5cb5fef428067b7f30, \< b5332a9f3f3d884a1b646ce155e664cc558c1722; Linux 5.0.

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

Yes. Fixed in Linux 999d606a820c36ae9b9e9611360c8b3d8d4bb777, Linux 60ade0d56b06537a28884745059b3801c78e03bc, Linux 06beaa1a9f6e501213195e47c30416032fd2bbd5, Linux 906c538340dde6d891df89fe7dac8eaa724e40da. No fix listed yet: follow the vendor advisory.

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

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/999d606a820c36ae9b9e9611360c8b3d8d4bb777>
- patch: <https://git.kernel.org/stable/c/60ade0d56b06537a28884745059b3801c78e03bc>
- patch: <https://git.kernel.org/stable/c/06beaa1a9f6e501213195e47c30416032fd2bbd5>
- patch: <https://git.kernel.org/stable/c/906c538340dde6d891df89fe7dac8eaa724e40da>
- patch: <https://git.kernel.org/stable/c/b5332a9f3f3d884a1b646ce155e664cc558c1722>

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

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