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:
Marcel Moolenaar 2002-03-30 01:36:03 +00:00
parent d98975ba90
commit c61a2c84f0

View File

@ -48,7 +48,12 @@ efifs_open(const char *upath, struct open_file *f)
CHAR16 *cp;
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;
status = BS->HandleProtocol(dev->d_handle, &sfsid, (VOID **)&sfs);