svn commit: r351692 - head/sys/dev/usb/net

Hans Petter Selasky hselasky at FreeBSD.org
Mon Sep 2 08:31:19 UTC 2019


Author: hselasky
Date: Mon Sep  2 08:31:18 2019
New Revision: 351692
URL: https://svnweb.freebsd.org/changeset/base/351692

Log:
  Fix regression issue after r351616. Make sure the mbuf queue gets initialized.
  
  Found by:	gonzo@
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/dev/usb/net/usb_ethernet.c

Modified: head/sys/dev/usb/net/usb_ethernet.c
==============================================================================
--- head/sys/dev/usb/net/usb_ethernet.c	Mon Sep  2 08:20:02 2019	(r351691)
+++ head/sys/dev/usb/net/usb_ethernet.c	Mon Sep  2 08:31:18 2019	(r351692)
@@ -219,6 +219,7 @@ ue_attach_post_task(struct usb_proc_msg *_task)
 	ue->ue_unit = alloc_unr(ueunit);
 	usb_callout_init_mtx(&ue->ue_watchdog, ue->ue_mtx, 0);
 	sysctl_ctx_init(&ue->ue_sysctl_ctx);
+	mbufq_init(&ue->ue_rxq, 0 /* unlimited length */);
 
 	error = 0;
 	CURVNET_SET_QUIET(vnet0);
@@ -284,6 +285,11 @@ ue_attach_post_task(struct usb_proc_msg *_task)
 
 fail:
 	CURVNET_RESTORE();
+
+	/* drain mbuf queue */
+	mbufq_drain(&ue->ue_rxq);
+
+	/* free unit */
 	free_unr(ueunit, ue->ue_unit);
 	if (ue->ue_ifp != NULL) {
 		if_free(ue->ue_ifp);
@@ -329,6 +335,9 @@ uether_ifdetach(struct usb_ether *ue)
 
 		/* free sysctl */
 		sysctl_ctx_free(&ue->ue_sysctl_ctx);
+
+		/* drain mbuf queue */
+		mbufq_drain(&ue->ue_rxq);
 
 		/* free unit */
 		free_unr(ueunit, ue->ue_unit);


More information about the svn-src-head mailing list