net: stmmac: WARN if tx_skbuff entries are reused before cleared
authorNiklas Cassel <niklas.cassel@axis.com>
Mon, 19 Feb 2018 17:11:11 +0000 (18:11 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Feb 2018 19:13:18 +0000 (14:13 -0500)
commitb4c9784cbff43a2b50f6db6e2400c8d003c21546
treebf88b22a04f84a153625a85f188eec18ef2d70a4
parentf66b533d2991ed4613b48a0516811413a37a3020
net: stmmac: WARN if tx_skbuff entries are reused before cleared

The current code assumes that a tx_skbuff entry has been cleared
by stmmac_tx_clean() before stmmac_xmit()/stmmac_tso_xmit()
assigns a new skb to that entry. However, since we never check
the current value before overwriting it, it is theoretically
possible that a non-NULL value is overwritten.

Add WARN_ONs to verify that each entry in tx_skbuff is NULL
before it is assigned a new value.

Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c