Module Name: src
Committed By: maxv
Date: Wed Jul 13 15:59:54 UTC 2016
Modified Files:
src/sys/compat/linux/arch/i386: linux_machdep.c
Log Message:
x86_alldisks can be NULL, so don't dereference it. Not tested, but obvious
enough.
To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/compat/linux/arch/i386/linux_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/compat/linux/arch/i386/linux_machdep.c
diff -u src/sys/compat/linux/arch/i386/linux_machdep.c:1.161 src/sys/compat/linux/arch/i386/linux_machdep.c:1.162
--- src/sys/compat/linux/arch/i386/linux_machdep.c:1.161 Tue Dec 8 21:27:50 2015
+++ src/sys/compat/linux/arch/i386/linux_machdep.c Wed Jul 13 15:59:54 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.161 2015/12/08 21:27:50 christos Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.162 2016/07/13 15:59:54 maxv Exp $ */
/*-
* Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.161 2015/12/08 21:27:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.162 2016/07/13 15:59:54 maxv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@@ -107,8 +107,9 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machde
#define DPRINTF(a)
#endif
-static struct biosdisk_info *fd2biosinfo(struct proc *, struct file *);
extern struct disklist *x86_alldisks;
+
+static struct biosdisk_info *fd2biosinfo(struct proc *, struct file *);
static void linux_save_ucontext(struct lwp *, struct trapframe *,
const sigset_t *, struct sigaltstack *, struct linux_ucontext *);
static void linux_save_sigcontext(struct lwp *, struct trapframe *,
@@ -761,6 +762,8 @@ fd2biosinfo(struct proc *p, struct file
struct nativedisk_info *nip;
struct disklist *dl = x86_alldisks;
+ if (dl == NULL)
+ return NULL;
if (fp->f_type != DTYPE_VNODE)
return NULL;
vp = (struct vnode *)fp->f_data;