Skip to contentSkip to conversation

CVE-2022-50245: rapidio: fix possible UAF when kfifo_alloc() fails

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Sep 15, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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

rapidio: fix possible UAF when kfifo_alloc() fails

If kfifo_alloc() fails in mport_cdev_open(), goto err_fifo and just free priv. But priv is still in the chdev->file_list, then list traversal may cause UAF. This fixes the following smatch warning:

drivers/rapidio/devices/rio_mport_cdev.c:1930 mport_cdev_open() warn: '&priv->list' not removed from list

The Linux kernel CVE team has assigned CVE-2022-50245 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 4.6 with commit e8de370188d098bb49483c287b44925957c3c9b6 and fixed in 4.9.337 with commit 2a6c75adf8192f07ddcdd4a1a13488c890a73919
	Issue introduced in 4.6 with commit e8de370188d098bb49483c287b44925957c3c9b6 and fixed in 4.14.303 with commit 2dfd60724d271a6ab99f93f40f38f2ced1ddbb87
	Issue introduced in 4.6 with commit e8de370188d098bb49483c287b44925957c3c9b6 and fixed in 4.19.270 with commit a253dde0403a153075ffb254f6f7b2635e49e97a
	Issue introduced in 4.6 with commit e8de370188d098bb49483c287b44925957c3c9b6 and fixed in 5.4.229 with commit 311b488405ac45af46756b1c8f1d27007b68b07e
	Issue introduced in 4.6 with commit e8de370188d098bb49483c287b44925957c3c9b6 and fixed in 5.10.163 with commit 5ee850645e42f541ce1ea8130c2b27cc495f965c
	Issue introduced in 4.6 with commit e8de370188d098bb49483c287b44925957c3c9b6 and fixed in 5.15.86 with commit 2f5cc7fd73fd6253cc71214f0dd499cc62feb469
	Issue introduced in 4.6 with commit e8de370188d098bb49483c287b44925957c3c9b6 and fixed in 6.0.16 with commit 2ba06e57f933f0eac242e8b389433da1cc00d4d5
	Issue introduced in 4.6 with commit e8de370188d098bb49483c287b44925957c3c9b6 and fixed in 6.1.2 with commit cb87af2c19c0993f6e21f75b963a5599c5a73e76
	Issue introduced in 4.6 with commit e8de370188d098bb49483c287b44925957c3c9b6 and fixed in 6.2 with commit 02d7d89f816951e0862147d751b1150d67aaebdd

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2022-50245

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/rapidio/devices/rio_mport_cdev.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/2a6c75adf8192f07ddcdd4a1a13488c890a73919
	https://git.kernel.org/stable/c/2dfd60724d271a6ab99f93f40f38f2ced1ddbb87
	https://git.kernel.org/stable/c/a253dde0403a153075ffb254f6f7b2635e49e97a
	https://git.kernel.org/stable/c/311b488405ac45af46756b1c8f1d27007b68b07e
	https://git.kernel.org/stable/c/5ee850645e42f541ce1ea8130c2b27cc495f965c
	https://git.kernel.org/stable/c/2f5cc7fd73fd6253cc71214f0dd499cc62feb469
	https://git.kernel.org/stable/c/2ba06e57f933f0eac242e8b389433da1cc00d4d5
	https://git.kernel.org/stable/c/cb87af2c19c0993f6e21f75b963a5599c5a73e76
	https://git.kernel.org/stable/c/02d7d89f816951e0862147d751b1150d67aaebdd