From owner-svn-src-head@FreeBSD.ORG Tue Nov 5 00:51:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8B387B4D; Tue, 5 Nov 2013 00:51:00 +0000 (UTC) (envelope-from luigi@FreeBSD.org) 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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5EE072FB7; Tue, 5 Nov 2013 00:51:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA50p0R0018258; Tue, 5 Nov 2013 00:51:00 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA50p0bZ018257; Tue, 5 Nov 2013 00:51:00 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201311050051.rA50p0bZ018257@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 5 Nov 2013 00:51:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r257664 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2013 00:51:00 -0000 Author: luigi Date: Tue Nov 5 00:50:59 2013 New Revision: 257664 URL: http://svnweb.freebsd.org/changeset/base/257664 Log: check errors on return from netmap_attach() Submitted by: Giuseppe Lettieri MFC after: 3 days Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Mon Nov 4 23:46:20 2013 (r257663) +++ head/sys/dev/netmap/netmap.c Tue Nov 5 00:50:59 2013 (r257664) @@ -535,7 +535,7 @@ BDG_NMB(struct netmap_mem_d *nmd, struct return (unlikely(i >= nmd->pools[NETMAP_BUF_POOL].objtotal)) ? lut[0].vaddr : lut[i].vaddr; } -static void bdg_netmap_attach(struct netmap_adapter *); +static int bdg_netmap_attach(struct netmap_adapter *); static int bdg_netmap_reg(struct ifnet *ifp, int onoff); int kern_netmap_regif(struct nmreq *nmr); @@ -1854,6 +1854,7 @@ get_ifp(struct nmreq *nmr, struct ifnet * and attach it to the ifp */ struct netmap_adapter tmp_na; + int error; if (nmr->nr_cmd) { /* nr_cmd must be 0 for a virtual port */ @@ -1884,7 +1885,12 @@ get_ifp(struct nmreq *nmr, struct ifnet strcpy(iter->if_xname, name); tmp_na.ifp = iter; /* bdg_netmap_attach creates a struct netmap_adapter */ - bdg_netmap_attach(&tmp_na); + error = bdg_netmap_attach(&tmp_na); + if (error) { + D("error %d", error); + free(iter, M_DEVBUF); + return error; + } cand2 = -1; /* only need one port */ } else if (NETMAP_CAPABLE(iter)) { /* this is a NIC */ /* make sure the NIC is not already in use */ @@ -4075,7 +4081,7 @@ done: } -static void +static int bdg_netmap_attach(struct netmap_adapter *arg) { struct netmap_adapter na; @@ -4095,7 +4101,7 @@ bdg_netmap_attach(struct netmap_adapter na.nm_mem = netmap_mem_private_new(arg->ifp->if_xname, na.num_tx_rings, na.num_tx_desc, na.num_rx_rings, na.num_rx_desc); - netmap_attach(&na, na.num_tx_rings); + return netmap_attach(&na, na.num_tx_rings); }