Don't blindly dereference f->f_devdata as if it's always a pointer to
an efi_devdesc structure. When we're netbooting, f->f_devdata holds the address of the network socket variable. Dereferencing this caused some very unpredictable behaviour, including proper functioning. So, as a sanity check, we first make sure f->f_dev points to our own devsw. If not, the open will fail before we use f->f_devdata. This solves the netboot hangs I invariably got whenever I used the latest toolchain to compile the EFI loader.
This commit is contained in:
parent
563788e98a
commit
08a102c3c4
@ -48,7 +48,12 @@ efifs_open(const char *upath, struct open_file *f)
|
|||||||
CHAR16 *cp;
|
CHAR16 *cp;
|
||||||
CHAR16 *path;
|
CHAR16 *path;
|
||||||
|
|
||||||
if (!dev->d_handle)
|
/*
|
||||||
|
* We cannot blindly assume that f->f_devdata points to a
|
||||||
|
* efi_devdesc structure. Before we dereference 'dev', make
|
||||||
|
* sure that the underlying device is ours.
|
||||||
|
*/
|
||||||
|
if (f->f_dev != &efifs_dev || dev->d_handle == NULL)
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
|
||||||
status = BS->HandleProtocol(dev->d_handle, &sfsid, (VOID **)&sfs);
|
status = BS->HandleProtocol(dev->d_handle, &sfsid, (VOID **)&sfs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user