CVE-2023-53591

Source
https://cve.org/CVERecord?id=CVE-2023-53591
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2023-53591.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2023-53591
Downstream
Related
Published
2025-10-04T15:44:05.430Z
Modified
2026-03-20T12:33:14.677985Z
Summary
net/mlx5e: Fix deadlock in tc route query code
Details

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

net/mlx5e: Fix deadlock in tc route query code

Cited commit causes ABBA deadlock[0] when peer flows are created while holding the devcom rw semaphore. Due to peer flows offload implementation the lock is taken much higher up the call chain and there is no obvious way to easily fix the deadlock. Instead, since tc route query code needs the peer eswitch structure only to perform a lookup in xarray and doesn't perform any sleeping operations with it, refactor the code for lockless execution in following ways:

  • RCUify the devcom 'data' pointer. When resetting the pointer synchronously wait for RCU grace period before returning. This is fine since devcom is currently only used for synchronization of pairing/unpairing of eswitches which is rare and already expensive as-is.

  • Wrap all usages of 'paired' boolean in {READ|WRITE}ONCE(). The flag has already been used in some unlocked contexts without proper annotations (e.g. users of mlx5devcomispaired() function), but it wasn't an issue since all relevant code paths checked it again after obtaining the devcom semaphore. Now it is also used by mlx5devcomgetpeerdata_rcu() as "best effort" check to return NULL when devcom is being unpaired. Note that while RCU read lock doesn't prevent the unpaired flag from being changed concurrently it still guarantees that reader can continue to use 'data'.

  • Refactor mlx5etcqueryroutevport() function to use new mlx5devcomgetpeerdata_rcu() API which fixes the deadlock.

[0]:

[ 164.599612] ====================================================== [ 164.600142] WARNING: possible circular locking dependency detected [ 164.600667] 6.3.0-rc3+ #1 Not tainted [ 164.601021] ------------------------------------------------------ [ 164.601557] handler1/3456 is trying to acquire lock: [ 164.601998] ffff88811f1714b0 (&esw->offloads.encaptbllock){+.+.}-{3:3}, at: mlx5eattachencap+0xd8/0x8b0 [mlx5core] [ 164.603078] but task is already holding lock: [ 164.603617] ffff88810137fc98 (&comp->sem){++++}-{3:3}, at: mlx5devcomgetpeerdata+0x37/0x80 [mlx5core] [ 164.604459] which lock already depends on the new lock.

[ 164.605190] the existing dependency chain (in reverse order) is: [ 164.605848] -> #1 (&comp->sem){++++}-{3:3}: [ 164.606380] downread+0x39/0x50 [ 164.606772] mlx5devcomgetpeerdata+0x37/0x80 [mlx5core] [ 164.607336] mlx5etcqueryroutevport+0x86/0xc0 [mlx5core] [ 164.607914] mlx5etctunroutelookup+0x1a4/0x1d0 [mlx5core] [ 164.608495] mlx5eattachdecaproute+0xc6/0x1e0 [mlx5core] [ 164.609063] mlx5etcaddfdbflow+0x1ea/0x360 [mlx5_core] [ 164.609627] __mlx5eaddfdbflow+0x2d2/0x430 [mlx5core] [ 164.610175] mlx5econfigureflower+0x952/0x1a20 [mlx5core] [ 164.610741] tcsetupcbadd+0xd4/0x200 [ 164.611146] flhwreplacefilter+0x14c/0x1f0 [clsflower] [ 164.611661] flchange+0xc95/0x18a0 [clsflower] [ 164.612116] tcnewtfilter+0x3fc/0xd20 [ 164.612516] rtnetlinkrcvmsg+0x418/0x5b0 [ 164.612936] netlinkrcvskb+0x54/0x100 [ 164.613339] netlinkunicast+0x190/0x250 [ 164.613746] netlinksendmsg+0x245/0x4a0 [ 164.614150] sock_sendmsg+0x38/0x60 [ 164.614522] ____sys_sendmsg+0x1d0/0x1e0 [ 164.614934] ___sys_sendmsg+0x80/0xc0 [ 164.615320] __syssendmsg+0x51/0x90 [ 164.615701] dosyscall64+0x3d/0x90 [ 164.616083] entrySYSCALL64afterhwframe+0x46/0xb0 [ 164.616568] -> #0 (&esw->offloads.encaptbl_lock){+.+.}-{3:3}: [ 164.617210] __lockacquire+0x159e/0x26e0 [ 164.617638] lockacquire+0xc2/0x2a0 [ 164.618018] __mutexlock+0x92/0xcd0 [ 164.618401] mlx5eattachencap+0xd8/0x8b0 [mlx5core] [ 164.618943] postprocessattr+0x153/0x2d0 [ ---truncated---

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/53xxx/CVE-2023-53591.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
f9d196bd632b8b79261ec3366c30ec3923ea9a02
Fixed
69966bce28da6aadccfd968b75d128a79da32d17
Fixed
362063df6ceec80b0b6798b61ae03504dcc125a5
Fixed
a7236e420a7d8082b1df4b3e05c739dd2642a662
Fixed
691c041bf20899fc13c793f92ba61ab660fa3a30
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
0 Unknown introduced commit / All previous commits are affected
Last affected
87a0625cf1c76caeaa15c576a0b2fcad4b9387d0
Last affected
7778fe1a6a6c069a460e4e3ff8ed3722392a4b5b

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2023-53591.json"