Subject: CVE-2024-36959: pinctrl: devicetree: fix refcount leak in pinctrl_dt_to_map()

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

pinctrl: devicetree: fix refcount leak in pinctrl_dt_to_map()

If we fail to allocate propname buffer, we need to drop the reference
count we just took. Because the pinctrl_dt_free_maps() includes the
droping operation, here we call it directly.

The Linux kernel CVE team has assigned CVE-2024-36959 to this issue.

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

	Issue introduced in 4.19.267 with commit a988dcd3dd9e and fixed in 4.19.314 with commit 06780473cb8a
	Issue introduced in 5.4.225 with commit 040f726fecd8 and fixed in 5.4.276 with commit 47d253c48549
	Issue introduced in 5.10.156 with commit 777430aa4ddc and fixed in 5.10.217 with commit 35ab679e8bb5
	Issue introduced in 5.15.80 with commit 97e5b508e961 and fixed in 5.15.159 with commit 76aa2440deb9
	Issue introduced in 6.1 with commit 91d5c5060ee2 and fixed in 6.1.91 with commit 518d5ddafeb0
	Issue introduced in 6.1 with commit 91d5c5060ee2 and fixed in 6.6.31 with commit 026e24cf3173
	Issue introduced in 6.1 with commit 91d5c5060ee2 and fixed in 6.8.10 with commit c7e02ccc9fdc
	Issue introduced in 6.1 with commit 91d5c5060ee2 and fixed in 6.9 with commit a0cedbcc8852
	Issue introduced in 4.9.334 with commit aaf552c5d53a
	Issue introduced in 4.14.300 with commit b4d9f55cd384
	Issue introduced in 6.0.10 with commit 5834a3a98cd2

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-2024-36959
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/pinctrl/devicetree.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/06780473cb8a858d1d6cab2673e021b072a852d1
	https://git.kernel.org/stable/c/47d253c485491caaf70d8cd8c0248ae26e42581f
	https://git.kernel.org/stable/c/35ab679e8bb5a81a4f922d3efbd43e32bce69274
	https://git.kernel.org/stable/c/76aa2440deb9a35507590f2c981a69a57ecd305d
	https://git.kernel.org/stable/c/518d5ddafeb084d6d9b1773ed85164300037d0e6
	https://git.kernel.org/stable/c/026e24cf31733dbd97f41cc9bc5273ace428eeec
	https://git.kernel.org/stable/c/c7e02ccc9fdc496fe51e440e3e66ac36509ca049
	https://git.kernel.org/stable/c/a0cedbcc8852d6c77b00634b81e41f17f29d9404