lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 20 Jul 2009 07:55:56 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	remi.denis-courmont@...ia.com
Cc:	oliver@...kum.org, netdev@...r.kernel.org,
	linux-usb@...r.kernel.org
Subject: Re: [PATCH] USB host CDC Phonet network interface driver

From: "RĂ©mi Denis-Courmont" <remi.denis-courmont@...ia.com>
Date: Mon, 20 Jul 2009 09:35:18 +0300

> In the racy case, tx_complete() fires, incrementation in
> usbpn_xmit() and decrementation in tx_complete() will cancel each
> other. So, regardless of their respective order, tx_queue will be
> unchanged, and the assertion remains valid. A fortiori, it works
> fine if usbpn_xmit() races with more than one call of tx_complete().

You can only do the wakeup race free without deadlocking the TX queue
state if you grab the TX path lock, as TG3 does:

	/* Need to make the tx_cons update visible to tg3_start_xmit()
	 * before checking for netif_queue_stopped().  Without the
	 * memory barrier, there is a small possibility that tg3_start_xmit()
	 * will miss it and cause the queue to be stopped forever.
	 */
	smp_mb();

	if (unlikely(netif_queue_stopped(tp->dev) &&
		     (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp)))) {
		netif_tx_lock(tp->dev);
		if (netif_queue_stopped(tp->dev) &&
		    (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp)))
			netif_wake_queue(tp->dev);
		netif_tx_unlock(tp->dev);
	}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ