efi_loader: efi_net: let efi_net_set_dp properly update the device path
authorAdriano Cordova <adrianox@gmail.com>
Mon, 27 Jan 2025 12:34:45 +0000 (09:34 -0300)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 10 Mar 2025 05:39:58 +0000 (06:39 +0100)
commit2eda179568771241c1c9fb09d6644a560fb8dcfc
treeaa74bcb1b9471c47a8364ad7b7cb11ebc23555b4
parent743c15b9fdd2f639012a2c26734dc146dc568218
efi_loader: efi_net: let efi_net_set_dp properly update the device path

This commit fixes an use after free introduced in Commit e55a4acb54
(" efi_loader: net: set EFI bootdevice device path to HTTP when loaded
from wget"). The logic in efi_net_set_dp is reworked so that when the
function is invoked it not only changes the value of the static variable
net_dp (this is how the function was implemented in e55a4acb54) but also
updates the protocol interface of the device path protocol in case efi
has started.

Fixes: e55a4acb54e8 ("efi_loader: net: set EFI bootdevice device path to HTTP when loaded from wget")
Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
lib/efi_loader/efi_net.c