summaryrefslogtreecommitdiff
path: root/lib/test_firmware.c
AgeCommit message (Collapse)Author
2017-01-25test_firmware: add test custom fallback triggerLuis R. Rodriguez
We have no custom fallback mechanism test interface. Provide one. This tests both the custom fallback mechanism and cancelling the it. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-25test_firmware: use device attribute groupsLuis R. Rodriguez
This simplifies init and exit. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-25test_firmware: move misc_device downLuis R. Rodriguez
This will make further changes easier to review. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-07test: firmware_class: add asynchronous request triggerBrian Norris
We might want to test for bugs like that found in commit f9692b2699bd ("firmware: fix possible use after free on name on asynchronous request"), where the asynchronous request API had race conditions. Let's add a simple file that will launch the async request, then wait until it's complete and report the status. It's not a true async test (we're using a mutex + wait_for_completion(), so we can't get more than one going at the same time), but it does help make sure the basic API is sane, and it can catch some class of bugs. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: Luis R. Rodriguez <mcgrof@suse.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2016-01-07test: firmware_class: use kstrndup() where appropriateBrian Norris
We're essentially just doing an open-coded kstrndup(). The only differences are with what happens after the first '\0' character, but request_firmware() doesn't care about that. Suggested-by: Kees Cook <keescook@chromium.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2016-01-07test: firmware_class: report errors properly on failureBrian Norris
request_firmware() failures currently won't get reported at all (the error code is discarded). What's more, we get confusing messages, like: # echo -n notafile > /sys/devices/virtual/misc/test_firmware/trigger_request [ 8280.311856] test_firmware: loading 'notafile' [ 8280.317042] test_firmware: load of 'notafile' failed: -2 [ 8280.322445] test_firmware: loaded: 0 # echo $? 0 Report the failures via write() errors, and don't say we "loaded" anything. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2014-07-17test: add firmware_class loader testKees Cook
This provides a simple interface to trigger the firmware_class loader to test built-in, filesystem, and user helper modes. Additionally adds tests via the new interface to the selftests tree. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>