CVE-2022-50349: misc: tifm: fix possible memory leak in tifm_7xx1_switch_media()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
misc: tifm: fix possible memory leak in tifm_7xx1_switch_media()
If device_register() returns error in tifm_7xx1_switch_media(), name of kobject which is allocated in dev_set_name() called in device_add() is leaked.
Never directly free @dev after calling device_register(), even if it returned an error! Always use put_device() to give up the reference initialized.
The Linux kernel CVE team has assigned CVE-2022-50349 to this issue.
Affected and fixed versions
===========================
Issue introduced in 2.6.22 with commit 2428a8fe2261e901e058d9ea8b6ed7e1b4268b79 and fixed in 4.9.337 with commit 2bbb222a54ff501f77ce593d21b76b79c905045e Issue introduced in 2.6.22 with commit 2428a8fe2261e901e058d9ea8b6ed7e1b4268b79 and fixed in 4.14.303 with commit d861b7d41b17942b337d4b87a70de7cd1dc44d4e Issue introduced in 2.6.22 with commit 2428a8fe2261e901e058d9ea8b6ed7e1b4268b79 and fixed in 4.19.270 with commit 1695b1adcc3a7d985cd22fa3b55761edf3fab50d Issue introduced in 2.6.22 with commit 2428a8fe2261e901e058d9ea8b6ed7e1b4268b79 and fixed in 5.4.229 with commit ee2715faf7e7153f5142ed09aacfa89a64d45dcb Issue introduced in 2.6.22 with commit 2428a8fe2261e901e058d9ea8b6ed7e1b4268b79 and fixed in 5.10.163 with commit 57c857353d5020bdec8284d9c0fee447484fe5e0 Issue introduced in 2.6.22 with commit 2428a8fe2261e901e058d9ea8b6ed7e1b4268b79 and fixed in 5.15.86 with commit 848c45964ded537107e010aaf353aa30a0855387 Issue introduced in 2.6.22 with commit 2428a8fe2261e901e058d9ea8b6ed7e1b4268b79 and fixed in 6.0.16 with commit 35abbc8406cc39e72d3ce85f6e869555afe50d54 Issue introduced in 2.6.22 with commit 2428a8fe2261e901e058d9ea8b6ed7e1b4268b79 and fixed in 6.1.2 with commit ef843ee20576039126d34d6eb5f45d14c3e6ce18 Issue introduced in 2.6.22 with commit 2428a8fe2261e901e058d9ea8b6ed7e1b4268b79 and fixed in 6.2 with commit fd2c930cf6a5b9176382c15f9acb1996e76e25ad
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-50349
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/misc/tifm_7xx1.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/2bbb222a54ff501f77ce593d21b76b79c905045e https://git.kernel.org/stable/c/d861b7d41b17942b337d4b87a70de7cd1dc44d4e https://git.kernel.org/stable/c/1695b1adcc3a7d985cd22fa3b55761edf3fab50d https://git.kernel.org/stable/c/ee2715faf7e7153f5142ed09aacfa89a64d45dcb https://git.kernel.org/stable/c/57c857353d5020bdec8284d9c0fee447484fe5e0 https://git.kernel.org/stable/c/848c45964ded537107e010aaf353aa30a0855387 https://git.kernel.org/stable/c/35abbc8406cc39e72d3ce85f6e869555afe50d54 https://git.kernel.org/stable/c/ef843ee20576039126d34d6eb5f45d14c3e6ce18 https://git.kernel.org/stable/c/fd2c930cf6a5b9176382c15f9acb1996e76e25ad