]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/powerpc: Fix resource leaks
authorMiaoqian Lin <linmq006@gmail.com>
Mon, 5 Dec 2022 08:44:27 +0000 (12:44 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:26:35 +0000 (13:26 +0100)
commit13c04f9712c0edf903f883b0309385bb409b5013
tree596319be700a9d8a96af3fe98c115aa58a180ef2
parent575717121c4fd8f4130b6356139696daf526659f
selftests/powerpc: Fix resource leaks

[ Upstream commit 8f4ab7da904ab7027ccd43ddb4f0094e932a5877 ]

In check_all_cpu_dscr_defaults, opendir() opens the directory stream.
Add missing closedir() in the error path to release it.

In check_cpu_dscr_default, open() creates an open file descriptor.
Add missing close() in the error path to release it.

Fixes: ebd5858c904b ("selftests/powerpc: Add test for all DSCR sysfs interfaces")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221205084429.570654-1-linmq006@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c