Date: Thu, 25 Sep 2014 16:22:33 +0000 (UTC) From: Luigi Rizzo <luigi@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272111 - head/sys/dev/netmap Message-ID: <201409251622.s8PGMXgM061070@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: luigi Date: Thu Sep 25 16:22:32 2014 New Revision: 272111 URL: http://svnweb.freebsd.org/changeset/base/272111 Log: fix a panic when passing ifioctl from a netmap file descriptor to the underlying device. This needs to be merged to 10.1 Reported by: Patrick Kelsey MFC after: 3 days Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Thu Sep 25 15:57:57 2014 (r272110) +++ head/sys/dev/netmap/netmap.c Thu Sep 25 16:22:32 2014 (r272111) @@ -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?201409251622.s8PGMXgM061070>