]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ARM: OMAP2+: Fix null pointer dereference and memory leak in omap_soc_device_init
authorKunwu Chan <chentao@kylinos.cn>
Thu, 23 Nov 2023 14:52:37 +0000 (22:52 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jan 2024 14:13:27 +0000 (15:13 +0100)
commit52c69a070b942cae778333282cbf36bec8a330e3
tree3c6dab267bbba56759f1a26a6de554f95802cce6
parentd3ffbbb0bca5fa8ec475d0fbe7af256b1ddab0c5
ARM: OMAP2+: Fix null pointer dereference and memory leak in omap_soc_device_init

[ Upstream commit c72b9c33ef9695ad7ce7a6eb39a9df8a01b70796 ]

kasprintf() returns a pointer to dynamically allocated memory which can
be NULL upon failure. When 'soc_dev_attr->family' is NULL,it'll trigger
the null pointer dereference issue, such as in 'soc_info_show'.

And when 'soc_device_register' fails, it's necessary to release
'soc_dev_attr->family' to avoid memory leaks.

Fixes: 6770b2114325 ("ARM: OMAP2+: Export SoC information to userspace")
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Message-ID: <20231123145237.609442-1-chentao@kylinos.cn>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm/mach-omap2/id.c