[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190617182354.10846-1-TheSven73@gmail.com>
Date: Mon, 17 Jun 2019 14:23:54 -0400
From: Sven Van Asbroeck <thesven73@...il.com>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: Stable <stable@...r.kernel.org>,
Mimi Zohar <zohar@...ux.vnet.ibm.com>,
Kees Cook <keescook@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH] 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.
Fixes: 6e852651f28e ("firmware: add call to LSM hook before firmware sysfs fallback")
Cc: Stable <stable@...r.kernel.org>
Cc: Mimi Zohar <zohar@...ux.vnet.ibm.com>
Cc: Kees Cook <keescook@...omium.org>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Sven Van Asbroeck <TheSven73@...il.com>
---
drivers/base/firmware_loader/fallback.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c
index f962488546b6..103b5d37fa86 100644
--- a/drivers/base/firmware_loader/fallback.c
+++ b/drivers/base/firmware_loader/fallback.c
@@ -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);
}
--
2.17.1
Powered by blists - more mailing lists