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] [day] [month] [year] [list]
Date:   Mon, 08 Apr 2019 21:22:56 +0100
From:   Ben Hutchings <ben@...adent.org.uk>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org, Jose Abreu <joabreu@...opsys.com>,
        "David S. Miller" <davem@...emloft.net>
Cc:     stable@...r.kernel.org, Joao Pinto <jpinto@...opsys.com>,
        Giuseppe Cavallaro <peppe.cavallaro@...com>,
        Alexandre Torgue <alexandre.torgue@...com>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.20 105/171] net: stmmac: Send TSO packets always from
 Queue 0

On Tue, 2019-03-12 at 10:08 -0700, Greg Kroah-Hartman wrote:
> 4.20-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> [ Upstream commit c5acdbee22a1b200dde07effd26fd1f649e9ab8a ]
> 
> The number of TSO enabled channels in HW can be different than the
> number of total channels. There is no way to determined, at runtime, the
> number of TSO capable channels and its safe to assume that if TSO is
> enabled then at least channel 0 will be TSO capable.
> 
> Lets always send TSO packets from Queue 0.
> 
> Signed-off-by: Jose Abreu <joabreu@...opsys.com>
> Cc: Joao Pinto <jpinto@...opsys.com>
> Cc: David S. Miller <davem@...emloft.net>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@...com>
> Cc: Alexandre Torgue <alexandre.torgue@...com>
> Signed-off-by: David S. Miller <davem@...emloft.net>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 5d83d6a7694b..f76f6ae3fa87 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -3033,8 +3033,17 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
>  
>  	/* Manage oversized TCP frames for GMAC4 device */
>  	if (skb_is_gso(skb) && priv->tso) {
> -		if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))
> +		if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) {
> +			/*
> +			 * There is no way to determine the number of TSO
> +			 * capable Queues. Let's use always the Queue 0
> +			 * because if TSO is supported then at least this
> +			 * one will be capable.
> +			 */
> +			skb_set_queue_mapping(skb, 0);

This is the wrong place to change the queue mapping.  stmmac_xmit() is
called with a specific TX queue locked, and accessing a different TX
queue results in a data race for all of that queue's state.

I think this commit should be reverted upstream and in all stable
branches.  Instead, the driver should implement the ndo_select_queue
operation and override the queue mapping there.

Ben.

>  			return stmmac_tso_xmit(skb, dev);
> +		}
>  	}
>  
>  	if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) {
-- 
Ben Hutchings
If God had intended Man to program,
we'd have been born with serial I/O ports.



Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ