Subject: CVE-2024-50070: pinctrl: stm32: check devm_kasprintf() returned value

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

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

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

pinctrl: stm32: check devm_kasprintf() returned value

devm_kasprintf() can return a NULL pointer on failure but this returned
value is not checked. Fix this lack and check the returned value.

Found by code review.

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

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

	Issue introduced in 6.6 with commit 32c170ff15b0 and fixed in 6.6.58 with commit 3b36bb1fca2b
	Issue introduced in 6.6 with commit 32c170ff15b0 and fixed in 6.11.5 with commit 1f266957ae12
	Issue introduced in 6.6 with commit 32c170ff15b0 and fixed in 6.12-rc4 with commit b0f0e3f0552a

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-50070
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/stm32/pinctrl-stm32.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/3b36bb1fca2b87f6292ca2a8593f297c5e9fab41
	https://git.kernel.org/stable/c/1f266957ae1207b0717c2d69096bc70654ae9fcb
	https://git.kernel.org/stable/c/b0f0e3f0552a566def55c844b0d44250c58e4df6