mirror of https://gitee.com/openkylin/linux.git
orinoco: Move context allocation after processing the skb
ezusb_xmit() allocates a context which is leaked if
orinoco_process_xmit_skb() returns an error.
Move ezusb_alloc_ctx() after the invocation of
orinoco_process_xmit_skb() because the context is not needed so early.
ezusb_access_ltv() will cleanup the context in case of an error.
Fixes: bac6fafd4d
("orinoco: refactor xmit path")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201113212252.2243570-2-bigeasy@linutronix.de
This commit is contained in:
parent
37ff144d29
commit
a31eb61564
|
@ -1221,13 +1221,6 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
if (skb->len < ETH_HLEN)
|
if (skb->len < ETH_HLEN)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0);
|
|
||||||
if (!ctx)
|
|
||||||
goto busy;
|
|
||||||
|
|
||||||
memset(ctx->buf, 0, BULK_BUF_SIZE);
|
|
||||||
buf = ctx->buf->data;
|
|
||||||
|
|
||||||
tx_control = 0;
|
tx_control = 0;
|
||||||
|
|
||||||
err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control,
|
err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control,
|
||||||
|
@ -1235,6 +1228,13 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
if (err)
|
if (err)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
|
ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0);
|
||||||
|
if (!ctx)
|
||||||
|
goto drop;
|
||||||
|
|
||||||
|
memset(ctx->buf, 0, BULK_BUF_SIZE);
|
||||||
|
buf = ctx->buf->data;
|
||||||
|
|
||||||
{
|
{
|
||||||
__le16 *tx_cntl = (__le16 *)buf;
|
__le16 *tx_cntl = (__le16 *)buf;
|
||||||
*tx_cntl = cpu_to_le16(tx_control);
|
*tx_cntl = cpu_to_le16(tx_control);
|
||||||
|
|
Loading…
Reference in New Issue