]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.16.8/test_firmware-fix-setting-old-custom-fw-path-back-on-exit-second-try.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.16.8 / test_firmware-fix-setting-old-custom-fw-path-back-on-exit-second-try.patch
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
5
6 From: Ben Hutchings <ben.hutchings@codethink.co.uk>
7
8 commit e538409257d0217a9bc715686100a5328db75a15 upstream.
9
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.
14
15 Instead, write a null byte.
16
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>
23
24
25 ---
26 tools/testing/selftests/firmware/fw_filesystem.sh | 6 ++++--
27 1 file changed, 4 insertions(+), 2 deletions(-)
28
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
33 fi
34 if [ "$OLD_FWPATH" = "" ]; then
35 - OLD_FWPATH=" "
36 + # A zero-length write won't work; write a null byte
37 + printf '\000' >/sys/module/firmware_class/parameters/path
38 + else
39 + echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path
40 fi
41 - echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path
42 rm -f "$FW"
43 rmdir "$FWPATH"
44 }