Skip to content

Commit 6e85265

Browse files
Mimi ZoharJames Morris
authored andcommitted
firmware: add call to LSM hook before firmware sysfs fallback
Add an LSM hook prior to allowing firmware sysfs fallback loading. Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Acked-by: Luis R. Rodriguez <mcgrof@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: James Morris <james.morris@microsoft.com>
1 parent 16c267a commit 6e85265

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/base/firmware_loader/fallback.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,8 @@ static bool fw_force_sysfs_fallback(enum fw_opt opt_flags)
651651

652652
static bool fw_run_sysfs_fallback(enum fw_opt opt_flags)
653653
{
654+
int ret;
655+
654656
if (fw_fallback_config.ignore_sysfs_fallback) {
655657
pr_info_once("Ignoring firmware sysfs fallback due to sysctl knob\n");
656658
return false;
@@ -659,6 +661,11 @@ static bool fw_run_sysfs_fallback(enum fw_opt opt_flags)
659661
if ((opt_flags & FW_OPT_NOFALLBACK))
660662
return false;
661663

664+
/* Also permit LSMs and IMA to fail firmware sysfs fallback */
665+
ret = security_kernel_load_data(LOADING_FIRMWARE);
666+
if (ret < 0)
667+
return ret;
668+
662669
return fw_force_sysfs_fallback(opt_flags);
663670
}
664671

0 commit comments

Comments
 (0)