Fix fwpath in efi netboot
authorMichael Chang <mchang@suse.com>
Mon, 19 Dec 2016 09:09:04 +0000 (17:09 +0800)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Thu, 22 Dec 2016 19:37:32 +0000 (22:37 +0300)
commit562c406763d6c078ccf9fad1058e6d618b2456da
tree008f1b6857562edb6ae750884a666d3ed939f8c2
parentce95549cc54b5d6f494608a7c390dba3aab4fba7
Fix fwpath in efi netboot

The path returned by grub_efi_net_config has already been stripped for the
directory part extracted from cached bootp packet. We should just return the
result to avoild it be stripped again.

It fixed the problem that grub.efi as NBP image always looking for grub.cfg and
platform directory in upper folder rather than current one it gets loaded while
$prefix is empty. The behavior is inconsistent with other architecture and how
we would expect empty $prefix going to be in general.

The only exception to the general rule of empty $prefix is that when loaded
from platform directory itself, the platform part is stripped thus upper folder
is used for looking up files. It meets the case for how grub-mknetdir lay out
the files under tftp root directory, but also hide away this issue to be
identified as it appears to be just works.

Also fix possible memory leak by moving grub_efi_get_filename() call after
grub_efi_net_config().
grub-core/kern/efi/init.c