svn commit: r272604 - stable/10/sys/dev/netmap

Luigi Rizzo luigi at FreeBSD.org
Mon Oct 6 09:46:22 UTC 2014


Author: luigi
Date: Mon Oct  6 09:46:21 2014
New Revision: 272604
URL: https://svnweb.freebsd.org/changeset/base/272604

Log:
  MFC r272111
  fix a panic when passing ifioctl from a netmap file descriptor to
  the underlying device. This needs to be merged to 10.1

Modified:
  stable/10/sys/dev/netmap/netmap.c

Modified: stable/10/sys/dev/netmap/netmap.c
==============================================================================
--- stable/10/sys/dev/netmap/netmap.c	Mon Oct  6 09:15:09 2014	(r272603)
+++ stable/10/sys/dev/netmap/netmap.c	Mon Oct  6 09:46:21 2014	(r272604)
@@ -2222,23 +2222,18 @@ netmap_ioctl(struct cdev *dev, u_long cm
 
 	default:	/* allow device-specific ioctls */
 	    {
-		struct socket so;
-		struct ifnet *ifp;
-
-		bzero(&so, sizeof(so));
-		NMG_LOCK();
-		error = netmap_get_na(nmr, &na, 0 /* don't create */); /* keep reference */
-		if (error) {
-			netmap_adapter_put(na);
-			NMG_UNLOCK();
-			break;
+		struct ifnet *ifp = ifunit_ref(nmr->nr_name);
+		if (ifp == NULL) {
+			error = ENXIO;
+		} else {
+			struct socket so;
+
+			bzero(&so, sizeof(so));
+			so.so_vnet = ifp->if_vnet;
+			// so->so_proto not null.
+			error = ifioctl(&so, cmd, data, td);
+			if_rele(ifp);
 		}
-		ifp = na->ifp;
-		so.so_vnet = ifp->if_vnet;
-		// so->so_proto not null.
-		error = ifioctl(&so, cmd, data, td);
-		netmap_adapter_put(na);
-		NMG_UNLOCK();
 		break;
 	    }
 


More information about the svn-src-all mailing list