efi_loader: CloseProtocol in tcg2_measure_gpt_data
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 7 Oct 2022 12:28:18 +0000 (14:28 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 10 Oct 2022 14:34:25 +0000 (16:34 +0200)
commitbb8bb3033e2a20e708884e4b6ba61e5326c1fa0f
tree4d6327ff382cae0b1da895d54393229a6cff3209
parentfcdf531dbc7b8869d97bf76d0e81c23b91156c6e
efi_loader: CloseProtocol in tcg2_measure_gpt_data

The CloseProtocol() boot service requires a handle as first argument.
Passing the protocol interface is incorrect.

CloseProtocol() only has an effect if called with a non-zero value for
agent_handle. HandleProtocol() uses an opaque agent_handle when invoking
OpenProtocol() (currently NULL). Therefore HandleProtocol() should be
avoided.

* Replace the LocateHandle() call by efi_search_protocol().
* Remove the CloseProtocol() call.
* Remove a superfluous goto.

Fixes: ce3dbc5d080d ("efi_loader: add UEFI GPT measurement")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_tcg2.c