Skip to contentSkip to conversation

CVE-2022-50865: tcp: fix a signed-integer-overflow bug in tcp_add_backlog()

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

tcp: fix a signed-integer-overflow bug in tcp_add_backlog()

The type of sk_rcvbuf and sk_sndbuf in struct sock is int, and in tcp_add_backlog(), the variable limit is caculated by adding sk_rcvbuf, sk_sndbuf and 64 * 1024, it may exceed the max value of int and overflow. This patch reduces the limit budget by halving the sndbuf to solve this issue since ACK packets are much smaller than the payload.

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

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

	Issue introduced in 4.9 with commit c9c3321257e1b95be9b375f811fb250162af8d39 and fixed in 5.4.278 with commit 9d04b4d0feee12bce6bfe37f30d8e953d3c30368
	Issue introduced in 4.9 with commit c9c3321257e1b95be9b375f811fb250162af8d39 and fixed in 5.10.153 with commit 4f23cb2be530785db284a685d1b1c30224d8a538
	Issue introduced in 4.9 with commit c9c3321257e1b95be9b375f811fb250162af8d39 and fixed in 5.15.77 with commit a85d39f14aa8a71e29cfb5eb5de02878a8779898
	Issue introduced in 4.9 with commit c9c3321257e1b95be9b375f811fb250162af8d39 and fixed in 6.0.7 with commit 28addf029417d53b1df062b4c87feb7bc033cb5f
	Issue introduced in 4.9 with commit c9c3321257e1b95be9b375f811fb250162af8d39 and fixed in 6.1 with commit ec791d8149ff60c40ad2074af3b92a39c916a03f

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

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:

	net/ipv4/tcp_ipv4.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/9d04b4d0feee12bce6bfe37f30d8e953d3c30368
	https://git.kernel.org/stable/c/4f23cb2be530785db284a685d1b1c30224d8a538
	https://git.kernel.org/stable/c/a85d39f14aa8a71e29cfb5eb5de02878a8779898
	https://git.kernel.org/stable/c/28addf029417d53b1df062b4c87feb7bc033cb5f
	https://git.kernel.org/stable/c/ec791d8149ff60c40ad2074af3b92a39c916a03f