From owner-svn-src-all@freebsd.org Fri Jul 29 16:33:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15907BA7672; Fri, 29 Jul 2016 16:33:47 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D66E1155B; Fri, 29 Jul 2016 16:33:46 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6TGXkBg068065; Fri, 29 Jul 2016 16:33:46 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6TGXjVY068064; Fri, 29 Jul 2016 16:33:45 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201607291633.u6TGXjVY068064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Fri, 29 Jul 2016 16:33:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303488 - head/sys/dev/xen/netfront X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2016 16:33:47 -0000 Author: royger Date: Fri Jul 29 16:33:45 2016 New Revision: 303488 URL: https://svnweb.freebsd.org/changeset/base/303488 Log: xen-netfront: fix trying to send packets with disconnected netfront In certain circumstances xn_txq_mq_start might be called with num_queues == 0 during the resume phase after a migration, which can trigger a KASSERT. Fix this by making sure the carrier is on before trying to transmit, or else return that the queues are full. Just as a note, I haven't been able to reproduce this crash on my test systems, but I still think it's possible and worth fixing. Reported by: Karl Pielorz Sponsored by: Citrix Systems R&D MFC after: 5 days Reviewed by: Wei Liu Differential revision: https://reviews.freebsd.org/D7349 Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Fri Jul 29 16:28:51 2016 (r303487) +++ head/sys/dev/xen/netfront/netfront.c Fri Jul 29 16:33:45 2016 (r303488) @@ -2157,6 +2157,9 @@ xn_txq_mq_start(struct ifnet *ifp, struc np = ifp->if_softc; npairs = np->num_queues; + if (!netfront_carrier_ok(np)) + return (ENOBUFS); + KASSERT(npairs != 0, ("called with 0 available queues")); /* check if flowid is set */