]> git.baikalelectronics.ru Git - kernel.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>
Wed, 18 Jan 2023 10:41:30 +0000 (11:41 +0100)
commitf985e8b84490723bf72cc6bbef96c6a1dd448dc3
treee52590d1a5eaf476763e660ced387da5ae0c7383
parent61714809e4c10892c88a6883edb3ad461be8d979
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: 2751660627ed ("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