From 9c73bdcf24bbfedcae8483127ea135ccb39a3155 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Mon, 3 Mar 2003 00:58:47 +0000 Subject: [PATCH] Fix a machine check abort caused by the EFI loader trying to open a file in the NFS file system when the underlying device is not a network device. A Sparc64 specific hack for this exact problem was already present (nfs.c:1.9, tftp.c:1.10), but the problem is not specific to Sparc64. The hack has been promoted to a non-i386 test because on non-i386 architectures it's either impossible to have non-network devices coexist in the same loader with the NFS FS, or network and non-network device coexist and NFS filesystems can only be used on top of network devices. I believe i386 pxeboot is where this does not hold. The root cause of this problem is in open.c where each file system is tried until no more file systems exist or a file system returns success. There's no notion of a list of valid file systems given the underlying device and the non-existence of a file can cause the invalid combination to be tried. --- lib/libstand/nfs.c | 3 ++- lib/libstand/tftp.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libstand/nfs.c b/lib/libstand/nfs.c index 76a4b8d8c12..82fa08b3d29 100644 --- a/lib/libstand/nfs.c +++ b/lib/libstand/nfs.c @@ -412,10 +412,11 @@ nfs_open(upath, f) return (ENXIO); } -#ifdef __sparc64__ +#ifndef __i386__ if (strcmp(f->f_dev->dv_name, "net") != 0) return(EINVAL); #endif + if (!(desc = socktodesc(*(int *)(f->f_devdata)))) return(EINVAL); diff --git a/lib/libstand/tftp.c b/lib/libstand/tftp.c index 357cf00d17b..3a6630c87c5 100644 --- a/lib/libstand/tftp.c +++ b/lib/libstand/tftp.c @@ -254,10 +254,11 @@ tftp_open(path, f) struct iodesc *io; int res; -#ifdef __sparc64__ +#ifndef __i386__ if (strcmp(f->f_dev->dv_name, "net") != 0) return (EINVAL); #endif + tftpfile = (struct tftp_handle *) malloc(sizeof(*tftpfile)); if (!tftpfile) return (ENOMEM);