CVE-2022-49712: usb: gadget: lpc32xx_udc: Fix refcount leak in lpc32xx_udc_probe
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: lpc32xx_udc: Fix refcount leak in lpc32xx_udc_probe
of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. of_node_put() will check NULL pointer.
The Linux kernel CVE team has assigned CVE-2022-49712 to this issue.
Affected and fixed versions
===========================
Issue introduced in 3.5 with commit 24a28e4283510dcd58890379a42b8a7d3201d9d3 and fixed in 4.9.320 with commit d85e4e6284a91aa2d1ab004e9d84b9c09b4aa203 Issue introduced in 3.5 with commit 24a28e4283510dcd58890379a42b8a7d3201d9d3 and fixed in 4.14.285 with commit 0ef6917c0524da5b88496b9706628ffef108b9bb Issue introduced in 3.5 with commit 24a28e4283510dcd58890379a42b8a7d3201d9d3 and fixed in 4.19.249 with commit 2a598da14856ead80c726b38ba426c68637d9211 Issue introduced in 3.5 with commit 24a28e4283510dcd58890379a42b8a7d3201d9d3 and fixed in 5.4.200 with commit b75bddfcc18170ce8e3fb695a76ec2dec4ce0ea5 Issue introduced in 3.5 with commit 24a28e4283510dcd58890379a42b8a7d3201d9d3 and fixed in 5.10.124 with commit 57901c658f77d9ea2e772f35cb38e47efb54c558 Issue introduced in 3.5 with commit 24a28e4283510dcd58890379a42b8a7d3201d9d3 and fixed in 5.15.49 with commit 46da1e4a8b6329479433b2a4056941dfdd7f3efd Issue introduced in 3.5 with commit 24a28e4283510dcd58890379a42b8a7d3201d9d3 and fixed in 5.18.6 with commit 727c82d003e0ec64411fd1257a9a57de4ad7a99a Issue introduced in 3.5 with commit 24a28e4283510dcd58890379a42b8a7d3201d9d3 and fixed in 5.19 with commit 4757c9ade34178b351580133771f510b5ffcf9c8
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-49712
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/usb/gadget/udc/lpc32xx_udc.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/d85e4e6284a91aa2d1ab004e9d84b9c09b4aa203 https://git.kernel.org/stable/c/0ef6917c0524da5b88496b9706628ffef108b9bb https://git.kernel.org/stable/c/2a598da14856ead80c726b38ba426c68637d9211 https://git.kernel.org/stable/c/b75bddfcc18170ce8e3fb695a76ec2dec4ce0ea5 https://git.kernel.org/stable/c/57901c658f77d9ea2e772f35cb38e47efb54c558 https://git.kernel.org/stable/c/46da1e4a8b6329479433b2a4056941dfdd7f3efd https://git.kernel.org/stable/c/727c82d003e0ec64411fd1257a9a57de4ad7a99a https://git.kernel.org/stable/c/4757c9ade34178b351580133771f510b5ffcf9c8