]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
firewire: test: Fix potential null dereference in firewire kunit test
authorCharles Han <hanchunchao@inspur.com>
Fri, 10 Jan 2025 08:42:37 +0000 (16:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Feb 2025 09:02:04 +0000 (10:02 +0100)
commit70fcb25472d90dd3b87cbee74b9eb68670b0c7b8
tree74d44a39bc0b05d97c3aa4538d0e323ae78de290
parent832b8f95a2832321b8200ae478ed988b25faaef4
firewire: test: Fix potential null dereference in firewire kunit test

[ Upstream commit 352fafe97784e81a10a7c74bd508f71a19b53c2a ]

kunit_kzalloc() may return a NULL pointer, dereferencing it without
NULL check may lead to NULL dereference.
Add a NULL check for test_state.

Fixes: 1c8506d62624 ("firewire: test: add test of device attributes for simple AV/C device")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Link: https://lore.kernel.org/r/20250110084237.8877-1-hanchunchao@inspur.com
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firewire/device-attribute-test.c