firmware: improve LSM/IMA security behaviour
Subsystems (3)
PATCH 1/1 firmware: improve LSM/IMA security behaviour
The firmware loader queries if LSM/IMA permits it to load firmware via the sysfs fallback. Unfortunately, the code does the opposite:
it expressly permits sysfs fw loading if security_kernel_load_data( LOADING_FIRMWARE) returns -EACCES. This happens because a zero-on-success return value is cast to a bool that's true on success.
Fix the return value handling so we get the correct behaviour.
To: Luis Chamberlain <[email protected]>
--- drivers/base/firmware_loader/fallback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/firmware_loader/fallback.c +1 -1
@@ -659,7 +659,7 @@ static bool fw_run_sysfs_fallback(enum fw_opt opt_flags)/* Also permit LSMs and IMA to fail firmware sysfs fallback */ ret =security_kernel_load_data (LOADING_FIRMWARE );if (ret <0 ) -return ret; +return false;return fw_force_sysfs_fallback (opt_flags); }
Signature · 1 line
2.17.1
Quoted 7 lines · Sven Van Asbroeck
The firmware loader queries if LSM/IMA permits it to load firmware via the sysfs fallback. Unfortunately, the code does the opposite:
it expressly permits sysfs fw loading ifsecurity_kernel_load_data( LOADING_FIRMWARE)returns-EACCES. This happens because a zero-on-success return value is cast to a bool that's true on success.Fix the return value handling so we get the correct behaviour.