Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/common Handle case where compat_ifioctl() is call...



details:   https://anonhg.NetBSD.org/src/rev/8455b281daf5
branches:  trunk
changeset: 809439:8455b281daf5
user:      njoly <njoly%NetBSD.org@localhost>
date:      Sat Jul 11 07:43:32 2015 +0000

description:
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@.

diffstat:

 sys/compat/common/if_43.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (35 lines):

diff -r 4db88ff0368c -r 8455b281daf5 sys/compat/common/if_43.c
--- a/sys/compat/common/if_43.c Sat Jul 11 06:40:37 2015 +0000
+++ b/sys/compat/common/if_43.c Sat Jul 11 07:43:32 2015 +0000
@@ -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 @@
         */
        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) {



Home | Main Index | Thread Index | Old Index