Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/common Apply if_get/if_put to compat_ifioctl



details:   https://anonhg.NetBSD.org/src/rev/52fea3524381
branches:  trunk
changeset: 816788:52fea3524381
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Jul 25 08:30:19 2016 +0000

description:
Apply if_get/if_put to compat_ifioctl

diffstat:

 sys/compat/common/if_43.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 74185c9c3af3 -r 52fea3524381 sys/compat/common/if_43.c
--- a/sys/compat/common/if_43.c Mon Jul 25 06:20:26 2016 +0000
+++ b/sys/compat/common/if_43.c Mon Jul 25 08:30:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_43.c,v 1.11 2015/07/11 07:43:32 njoly Exp $ */
+/*     $NetBSD: if_43.c,v 1.12 2016/07/25 08:30:19 ozaki-r 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.11 2015/07/11 07:43:32 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.12 2016/07/25 08:30:19 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -218,11 +218,16 @@
        struct ifreq *ifr = (struct ifreq *)data;
        struct ifreq ifrb;
        struct oifreq *oifr = NULL;
-       struct ifnet *ifp = ifunit(ifr->ifr_name);
+       struct ifnet *ifp;
        struct sockaddr *sa;
+       struct psref psref;
+       int bound = curlwp_bind();
 
-       if (ifp == NULL)
+       ifp = if_get(ifr->ifr_name, &psref);
+       if (ifp == NULL) {
+               curlwp_bindx(bound);
                return ENXIO;
+       }
 
        /*
         * If we have not been converted, make sure that we are.
@@ -257,6 +262,8 @@
        }
 
        error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so, cmd, ifr, ifp);
+       if_put(ifp, &psref);
+       curlwp_bindx(bound);
 
        switch (ocmd) {
        case OOSIOCGIFADDR:



Home | Main Index | Thread Index | Old Index