Skip to contentSkip to conversation

CVE-2021-47671: can: etas_es58x: es58x_rx_err_msg(): fix memory leak in error path

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

can: etas_es58x: es58x_rx_err_msg(): fix memory leak in error path

In es58x_rx_err_msg(), if can->do_set_mode() fails, the function directly returns without calling netif_rx(skb). This means that the skb previously allocated by alloc_can_err_skb() is not freed. In other terms, this is a memory leak.

This patch simply removes the return statement in the error branch and let the function continue.

Issue was found with GCC -fanalyzer, please follow the link below for details.

The Linux kernel CVE team has assigned CVE-2021-47671 to this issue.

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

	Issue introduced in 5.13 with commit 8537257874e949a59c834cecfd5a063e11b64b0b and fixed in 5.14.19 with commit 4f389e1276a5389c92cef860c9fde8e1c802a871
	Issue introduced in 5.13 with commit 8537257874e949a59c834cecfd5a063e11b64b0b and fixed in 5.15.3 with commit 7eb0881aec26099089f12ae850aebd93190b1dfe
	Issue introduced in 5.13 with commit 8537257874e949a59c834cecfd5a063e11b64b0b and fixed in 5.16 with commit d9447f768bc8c60623e4bb3ce65b8f4654d33a50

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-2021-47671

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/net/can/usb/etas_es58x/es58x_core.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/4f389e1276a5389c92cef860c9fde8e1c802a871
	https://git.kernel.org/stable/c/7eb0881aec26099089f12ae850aebd93190b1dfe
	https://git.kernel.org/stable/c/d9447f768bc8c60623e4bb3ce65b8f4654d33a50