Module Name:    src
Committed By:   njoly
Date:           Sat Jul 11 07:43:32 UTC 2015

Modified Files:
        src/sys/compat/common: if_43.c

Log Message:
Handle case where compat_ifioctl() is called with ocmd != cmd, as found in
compat Linux. Do not crash by ensuring that oifr is correctly set.

Fix crash reported by Robert Swindells on tech-kern@.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/common/if_43.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/common/if_43.c
diff -u src/sys/compat/common/if_43.c:1.10 src/sys/compat/common/if_43.c:1.11
--- src/sys/compat/common/if_43.c:1.10	Tue May 12 20:42:46 2015
+++ src/sys/compat/common/if_43.c	Sat Jul 11 07:43:32 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_43.c,v 1.10 2015/05/12 20:42:46 christos Exp $	*/
+/*	$NetBSD: if_43.c,v 1.11 2015/07/11 07:43:32 njoly Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.10 2015/05/12 20:42:46 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.11 2015/07/11 07:43:32 njoly Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -231,11 +231,11 @@ compat_ifioctl(struct socket *so, u_long
 	 */
 	if (cmd == ocmd) {
 		cmd = compat_cvtcmd(ocmd);
-		if (cmd != ocmd) {
-			oifr = data;
-			data = ifr = &ifrb;
-			ifreqo2n(oifr, ifr);
-		}
+	}
+	if (cmd != ocmd) {
+		oifr = data;
+		data = ifr = &ifrb;
+		ifreqo2n(oifr, ifr);
 	}
 
 	switch (ocmd) {

Reply via email to