From owner-svn-src-stable-10@FreeBSD.ORG Mon Oct 6 09:46:22 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB2B1B9E; Mon, 6 Oct 2014 09:46:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 981ACDD6; Mon, 6 Oct 2014 09:46:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s969kMa9074395; Mon, 6 Oct 2014 09:46:22 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s969kMiO074394; Mon, 6 Oct 2014 09:46:22 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201410060946.s969kMiO074394@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Mon, 6 Oct 2014 09:46:22 +0000 (UTC) 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 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 09:46:22 -0000 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; }