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, 13 Feb 2012 19:15:14 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Mugunthan V N <mugunthanvnm@...com>
Cc:	netdev@...r.kernel.org, davem@...emloft.net
Subject: Re: [PATCH 2/2] netdev: driver: ethernet: Add TI CPSW driver

Le lundi 13 février 2012 à 11:34 +0530, Mugunthan V N a écrit :
> This patch adds support for TI's CPSW driver.
> 
> The three port switch gigabit ethernet subsystem provides ethernet packet
> communication and can be configured as an ethernet switch. Supports
> 10/100/1000 Mbps.
> 
> Signed-off-by: Cyril Chemparathy <cyril@...com>
> Signed-off-by: Sriramakrishnan A G <srk@...com>
> Signed-off-by: Mugunthan V N <mugunthanvnm@...com>

...

> +
> +static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
> +				       struct net_device *ndev)
> +{
> +	struct cpsw_priv *priv = netdev_priv(ndev);
> +	int ret;
> +
> +	ndev->trans_start = jiffies;

	Are you sure trans_start needs to  be updated ?

> +
> +	ret = skb_padto(skb, CPSW_MIN_PACKET_SIZE);
> +	if (unlikely(ret < 0)) {
> +		msg(err, tx_err, "packet pad failed");
> +		goto fail;

Ouch... if skb_padto() fails, we stop queue forever, and skb is freed
twice...

correct sequence is :
	
	if (skb_padto(skb, CPSW_MIN_PACKET_SIZE)) {
		priv->stats.tx_dropped++;
		return NETDEV_TX_OK;
	}

By the way, skb_padto() doesnt change skb->len, be warned !


> +	}
> +
> +	ret = cpdma_chan_submit(priv->txch, skb, skb->data,
> +				skb->len, GFP_KERNEL);

This GFP_KERNEL cannot be right, even if cpdma_chan_submit() ignores its
last argument.

> +	if (unlikely(ret != 0)) {
> +		msg(err, tx_err, "desc submit failed");
> +		goto fail;
> +	}
> +
> +	return NETDEV_TX_OK;
> +fail:
> +	priv->stats.tx_dropped++;
> +	netif_stop_queue(ndev);
> +	return NETDEV_TX_BUSY;
> +}
> +



--
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