1 From e538409257d0217a9bc715686100a5328db75a15 Mon Sep 17 00:00:00 2001
2 From: Ben Hutchings <ben.hutchings@codethink.co.uk>
3 Date: Wed, 4 Apr 2018 22:38:49 +0200
4 Subject: test_firmware: fix setting old custom fw path back on exit, second try
6 From: Ben Hutchings <ben.hutchings@codethink.co.uk>
8 commit e538409257d0217a9bc715686100a5328db75a15 upstream.
10 Commit 65c79230576 tried to clear the custom firmware path on exit by
11 writing a single space to the firmware_class.path parameter. This
12 doesn't work because nothing strips this space from the value stored
13 and fw_get_filesystem_firmware() only ignores zero-length paths.
15 Instead, write a null byte.
17 Fixes: 0a8adf58475 ("test: add firmware_class loader test")
18 Fixes: 65c79230576 ("test_firmware: fix setting old custom fw path back on exit")
19 Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
20 Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>
21 Cc: stable <stable@vger.kernel.org>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26 tools/testing/selftests/firmware/fw_filesystem.sh | 6 ++++--
27 1 file changed, 4 insertions(+), 2 deletions(-)
29 --- a/tools/testing/selftests/firmware/fw_filesystem.sh
30 +++ b/tools/testing/selftests/firmware/fw_filesystem.sh
31 @@ -46,9 +46,11 @@ test_finish()
32 echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout
34 if [ "$OLD_FWPATH" = "" ]; then
36 + # A zero-length write won't work; write a null byte
37 + printf '\000' >/sys/module/firmware_class/parameters/path
39 + echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path
41 - echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path