CVE-2021-47402

See a problem?
Source
https://nvd.nist.gov/vuln/detail/CVE-2021-47402
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-47402.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2021-47402
Related
Published
2024-05-21T15:15:25Z
Modified
2024-09-18T03:17:27.410210Z
Summary
[none]
Details

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

net: sched: flower: protect fl_walk() with rcu

Patch that refactored flwalk() to use idrforeachentrycontinueul() also removed rcu protection of individual filters which causes following use-after-free when filter is deleted concurrently. Fix fl_walk() to obtain rcu read lock while iterating and taking the filter reference and temporary release the lock while calling arg->fn() callback that can sleep.

KASAN trace:

[ 352.773640] ================================================================== [ 352.775041] BUG: KASAN: use-after-free in flwalk+0x159/0x240 [clsflower] [ 352.776304] Read of size 4 at addr ffff8881c8251480 by task tc/2987

[ 352.777862] CPU: 3 PID: 2987 Comm: tc Not tainted 5.15.0-rc2+ #2 [ 352.778980] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 [ 352.781022] Call Trace: [ 352.781573] dumpstacklvl+0x46/0x5a [ 352.782332] printaddressdescription.constprop.0+0x1f/0x140 [ 352.783400] ? flwalk+0x159/0x240 [clsflower] [ 352.784292] ? flwalk+0x159/0x240 [clsflower] [ 352.785138] kasanreport.cold+0x83/0xdf [ 352.785851] ? flwalk+0x159/0x240 [clsflower] [ 352.786587] kasancheckrange+0x145/0x1a0 [ 352.787337] flwalk+0x159/0x240 [clsflower] [ 352.788163] ? flput+0x10/0x10 [clsflower] [ 352.789007] ? mutexunlockslowpath.constprop.0+0x220/0x220 [ 352.790102] tcfchaindump+0x231/0x450 [ 352.790878] ? tcfchaintpdeleteempty+0x170/0x170 [ 352.791833] ? _mightsleep+0x2e/0xc0 [ 352.792594] ? tfilternotify+0x170/0x170 [ 352.793400] ? _mutexunlockslowpath.constprop.0+0x220/0x220 [ 352.794477] tcdumptfilter+0x385/0x4b0 [ 352.795262] ? tcnewtfilter+0x1180/0x1180 [ 352.796103] ? _modnodepagestate+0x1f/0xc0 [ 352.796974] ? _buildskbaround+0x10e/0x130 [ 352.797826] netlinkdump+0x2c0/0x560 [ 352.798563] ? netlinkgetsockopt+0x430/0x430 [ 352.799433] ? _mutexunlockslowpath.constprop.0+0x220/0x220 [ 352.800542] _netlinkdumpstart+0x356/0x440 [ 352.801397] rtnetlinkrcvmsg+0x3ff/0x550 [ 352.802190] ? tcnewtfilter+0x1180/0x1180 [ 352.802872] ? rtnlcalcit.isra.0+0x1f0/0x1f0 [ 352.803668] ? tcnewtfilter+0x1180/0x1180 [ 352.804344] ? _copyfromiternocache+0x800/0x800 [ 352.805202] ? kasansettrack+0x1c/0x30 [ 352.805900] netlinkrcvskb+0xc6/0x1f0 [ 352.806587] ? rhtdeferredworker+0x6b0/0x6b0 [ 352.807455] ? rtnlcalcit.isra.0+0x1f0/0x1f0 [ 352.808324] ? netlinkack+0x4d0/0x4d0 [ 352.809086] ? netlinkdelivertap+0x62/0x3d0 [ 352.809951] netlinkunicast+0x353/0x480 [ 352.810744] ? netlinkattachskb+0x430/0x430 [ 352.811586] ? _allocskb+0xd7/0x200 [ 352.812349] netlinksendmsg+0x396/0x680 [ 352.813132] ? netlinkunicast+0x480/0x480 [ 352.813952] ? _importiovec+0x192/0x210 [ 352.814759] ? netlinkunicast+0x480/0x480 [ 352.815580] socksendmsg+0x6c/0x80 [ 352.816299] syssendmsg+0x3a5/0x3c0 [ 352.817096] ? kernelsendmsg+0x30/0x30 [ 352.817873] ? ia32sysrecvmmsg+0x150/0x150 [ 352.818753] syssendmsg+0xd8/0x140 [ 352.819518] ? sendmsgcopymsghdr+0x110/0x110 [ 352.820402] ? _sysrecvmsg+0xf4/0x1a0 [ 352.821110] ? _copymsghdrfromuser+0x260/0x260 [ 352.821934] ? _rawspinlock+0x81/0xd0 [ 352.822680] ? _handlemmfault+0xef3/0x1b20 [ 352.823549] ? rbinsertcolor+0x2a/0x270 [ 352.824373] ? copypagerange+0x16b0/0x16b0 [ 352.825209] ? perfeventupdateuserpage+0x2d0/0x2d0 [ 352.826190] ? _fgetlight+0xd9/0xf0 [ 352.826941] _syssendmsg+0xb3/0x130 [ 352.827613] ? _syssendmsgsock+0x20/0x20 [ 352.828377] ? douseraddrfault+0x2c5/0x8a0 [ 352.829184] ? fpregsassertstateconsistent+0x52/0x60 [ 352.830001] ? exittousermodeprepare+0x32/0x160 [ 352.830845] dosyscall64+0x35/0x80 [ 352.831445] entrySYSCALL64afterhwframe+0x44/0xae [ 352.832331] RIP: 0033:0x7f7bee973c17 [ ---truncated---

References

Affected packages

Debian:11 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.10.84-1

Affected versions

5.*

5.10.46-4
5.10.46-5
5.10.70-1~bpo10+1
5.10.70-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:12 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.14.12-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:13 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.14.12-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}