Module Name: src
Committed By: ozaki-r
Date: Mon Jul 25 08:30:19 UTC 2016
Modified Files:
src/sys/compat/common: if_43.c
Log Message:
Apply if_get/if_put to compat_ifioctl
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/compat/common/if_43.c:1.12
--- src/sys/compat/common/if_43.c:1.11 Sat Jul 11 07:43:32 2015
+++ src/sys/compat/common/if_43.c Mon Jul 25 08:30:19 2016
@@ -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 @@ compat_ifioctl(struct socket *so, u_long
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 @@ compat_ifioctl(struct socket *so, u_long
}
error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so, cmd, ifr, ifp);
+ if_put(ifp, &psref);
+ curlwp_bindx(bound);
switch (ocmd) {
case OOSIOCGIFADDR: