diff mbox series

[01/10] orinoco: Move context allocation after processing the skb

Message ID 20201113212252.2243570-2-bigeasy@linutronix.de (mailing list archive)
State Accepted
Commit a31eb615646a63370aa1da1053c45439c7653d83
Delegated to: Kalle Valo
Headers show
Series orinoco: Remove in_interrupt() usage. | expand

Commit Message

Sebastian Andrzej Siewior Nov. 13, 2020, 9:22 p.m. UTC
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: bac6fafd4d6a0 ("orinoco: refactor xmit path")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 .../net/wireless/intersil/orinoco/orinoco_usb.c    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Kalle Valo Nov. 24, 2020, 3:01 p.m. UTC | #1
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> 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: bac6fafd4d6a0 ("orinoco: refactor xmit path")
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

10 patches applied to wireless-drivers-next.git, thanks.

a31eb615646a orinoco: Move context allocation after processing the skb
915fd9db418f orinoco: Prepare stubs for in_interrupt() removal
29b2fe3f6f20 orinoco: Annotate ezusb_xmit()
46233f778604 orinoco: Annotate ezusb_init()
69476b25a4ba orinoco: Annotate firmware loading
154f2bae9bed orinoco: Annotate ezusb_read_pda()
39628fe48cb3 orinoco: Annotate ezusb_write_ltv()
47ab2a951eb9 orinoco: Remove ezusb_doicmd_wait()
a9a2678abacb orinoco: Annotate ezusb_docmd_wait()
a3d8a2599d47 orinoco: Annotate ezusb_read_ltv()
diff mbox series

Patch

diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
index 046f2453ad5d9..8419e13a79e2a 100644
--- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
+++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
@@ -1221,13 +1221,6 @@  static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (skb->len < ETH_HLEN)
 		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;
 
 	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)
 		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;
 		*tx_cntl = cpu_to_le16(tx_control);