CVE-2022-50704

Source
https://cve.org/CVERecord?id=CVE-2022-50704
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-50704.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-50704
Downstream
Related
Published
2025-12-24T10:55:19.295Z
Modified
2026-01-30T02:25:26.050789Z
Summary
USB: gadget: Fix use-after-free during usb config switch
Details

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

USB: gadget: Fix use-after-free during usb config switch

In the process of switching USB config from rndis to other config, if the hardware does not support the ->pullup callback, or the hardware encounters a low probability fault, both of them may cause the ->pullup callback to fail, which will then cause a system panic (use after free).

The gadget drivers sometimes need to be unloaded regardless of the hardware's behavior.

Analysis as follows:

(1) write /config/usb_gadget/g1/UDC "none"

getherdisconnect+0x2c/0x1f8 rndisdisable+0x4c/0x74 compositedisconnect+0x74/0xb0 configfscompositedisconnect+0x60/0x7c usbgadgetdisconnect+0x70/0x124 usbgadgetunregisterdriver+0xc8/0x1d8 gadgetdevdescUDCstore+0xec/0x1e4

(2) rm /config/usb_gadget/g1/configs/b.1/f1

rndisderegister+0x28/0x54 rndisfree+0x44/0x7c usbputfunction+0x14/0x1c configusbcfgunlink+0xc4/0xe0 configfsunlink+0x124/0x1c8 vfs_unlink+0x114/0x1dc

(3) rmdir /config/usb_gadget/g1/functions/rndis.gs4

panic+0x1fc/0x3d0 dopagefault+0xa8/0x46c domemabort+0x3c/0xac el1synchandler+0x40/0x78 0xffffff801138f880 rndisclose+0x28/0x34 ethstop+0x74/0x110 devclosemany+0x48/0x194 rollbackregisteredmany+0x118/0x814 unregisternetdev+0x20/0x30 gethercleanup+0x1c/0x38 rndisattrrelease+0xc/0x14 krefput+0x74/0xb8 configfsrmdir+0x314/0x374

If gadget->ops->pullup() return an error, function rndis_close() will be

called, then it will causes a use-after-free problem.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50704.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
0a55187a1ec8c03d0619e7ce41d10fdc39cff036
Fixed
30e926aa835ac2e6ad05822e4cb75833feb0d99f
Fixed
99a58ac42d9b6911834b0224b6782aea0c311346
Fixed
afdc12887f2b2ecf20d065a7d81ad29824155083

Affected versions

v4.*

v4.19
v4.19-rc7
v4.19-rc8
v4.20
v4.20-rc1
v4.20-rc2
v4.20-rc3
v4.20-rc4
v4.20-rc5
v4.20-rc6
v4.20-rc7

v5.*

v5.0
v5.0-rc1
v5.0-rc2
v5.0-rc3
v5.0-rc4
v5.0-rc5
v5.0-rc6
v5.0-rc7
v5.0-rc8
v5.1
v5.1-rc1
v5.1-rc2
v5.1-rc3
v5.1-rc4
v5.1-rc5
v5.1-rc6
v5.1-rc7
v5.10
v5.10-rc1
v5.10-rc2
v5.10-rc3
v5.10-rc4
v5.10-rc5
v5.10-rc6
v5.10-rc7
v5.11
v5.11-rc1
v5.11-rc2
v5.11-rc3
v5.11-rc4
v5.11-rc5
v5.11-rc6
v5.11-rc7
v5.12
v5.12-rc1
v5.12-rc1-dontuse
v5.12-rc2
v5.12-rc3
v5.12-rc4
v5.12-rc5
v5.12-rc6
v5.12-rc7
v5.12-rc8
v5.13
v5.13-rc1
v5.13-rc2
v5.13-rc3
v5.13-rc4
v5.13-rc5
v5.13-rc6
v5.13-rc7
v5.14
v5.14-rc1
v5.14-rc2
v5.14-rc3
v5.14-rc4
v5.14-rc5
v5.14-rc6
v5.14-rc7
v5.15
v5.15-rc1
v5.15-rc2
v5.15-rc3
v5.15-rc4
v5.15-rc5
v5.15-rc6
v5.15-rc7
v5.16
v5.16-rc1
v5.16-rc2
v5.16-rc3
v5.16-rc4
v5.16-rc5
v5.16-rc6
v5.16-rc7
v5.16-rc8
v5.17
v5.17-rc1
v5.17-rc2
v5.17-rc3
v5.17-rc4
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storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-50704.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
4.20.0
Fixed
6.0.16
Type
ECOSYSTEM
Events
Introduced
6.1.0
Fixed
6.1.2

Database specific

source

"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-50704.json"