Skip to contentSkip to conversation

CVE-2022-50138: RDMA/qedr: Fix potential memory leak in __qedr_alloc_mr()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jun 18, 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:

RDMA/qedr: Fix potential memory leak in __qedr_alloc_mr()

__qedr_alloc_mr() allocates a memory chunk for "mr->info.pbl_table" with init_mr_info(). When rdma_alloc_tid() and rdma_register_tid() fail, "mr" is released while "mr->info.pbl_table" is not released, which will lead to a memory leak.

We should release the "mr->info.pbl_table" with qedr_free_pbl() when error occurs to fix the memory leak.

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

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

	Issue introduced in 4.9 with commit e0290cce6ac02f8e5ec501f25f6f6900f384550c and fixed in 5.10.137 with commit 79ce50dddaf28b5c57911ecc80a2be17a0b17f83
	Issue introduced in 4.9 with commit e0290cce6ac02f8e5ec501f25f6f6900f384550c and fixed in 5.15.61 with commit 7e647a8d5fc0a2c8e0f36f585a6388286a25bb15
	Issue introduced in 4.9 with commit e0290cce6ac02f8e5ec501f25f6f6900f384550c and fixed in 5.18.18 with commit 07ba048df306dc93fc4d2ef670b9e24644a2069f
	Issue introduced in 4.9 with commit e0290cce6ac02f8e5ec501f25f6f6900f384550c and fixed in 5.19.2 with commit b4c9f7db9f0148423557539af0fdf513338efe08
	Issue introduced in 4.9 with commit e0290cce6ac02f8e5ec501f25f6f6900f384550c and fixed in 6.0 with commit b3236a64ddd125a455ef5b5316c1b9051b732974

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-50138

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/infiniband/hw/qedr/verbs.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/79ce50dddaf28b5c57911ecc80a2be17a0b17f83
	https://git.kernel.org/stable/c/7e647a8d5fc0a2c8e0f36f585a6388286a25bb15
	https://git.kernel.org/stable/c/07ba048df306dc93fc4d2ef670b9e24644a2069f
	https://git.kernel.org/stable/c/b4c9f7db9f0148423557539af0fdf513338efe08
	https://git.kernel.org/stable/c/b3236a64ddd125a455ef5b5316c1b9051b732974