]> git.ipfire.org Git - thirdparty/grub.git/commit
efi: Only register shim_lock verifier if shim_lock protocol is found and SB enabled
authorJavier Martinez Canillas <javierm@redhat.com>
Thu, 3 Dec 2020 15:01:49 +0000 (16:01 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Sat, 12 Dec 2020 00:17:25 +0000 (01:17 +0100)
commit132ddc42c70de2f03b42162da50d6ef40e97443a
tree04893b538c1c1a57146cbe0a957f904b26c245bc
parentd7e54b2e5feee95d2f83058ed30d883c450d1473
efi: Only register shim_lock verifier if shim_lock protocol is found and SB enabled

The shim_lock module registers a verifier to call shim's verify, but the
handler is registered even when the shim_lock protocol was not installed.

This doesn't cause a NULL pointer dereference in shim_lock_write() because
the shim_lock_init() function just returns GRUB_ERR_NONE if sl isn't set.

But in that case there's no point to even register the shim_lock verifier
since won't do anything. Additionally, it is only useful when Secure Boot
is enabled.

Finally, don't assume that the shim_lock protocol will always be present
when the shim_lock_write() function is called, and check for it on every
call to this function.

Reported-by: Michael Chang <mchang@suse.com>
Reported-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/commands/efi/shim_lock.c