Date: Mon, 6 Oct 2014 09:46:22 +0000 (UTC) From: Luigi Rizzo <luigi@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r272604 - stable/10/sys/dev/netmap Message-ID: <201410060946.s969kMiO074394@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410060946.s969kMiO074394>