Skip to contentSkip to conversation

libertas/libertas_tf: don't call kfree_skb() under spin_lock_irqsave()

PATCH In review Yang Yingliang 2 participants 7 messages Dec 6, 2022 – Dec 29, 2022 Marvell libertas wireless driver

lore
Share & tools
lore
#0 lore raw

cover libertas/libertas_tf: don't call kfree_skb() under spin_lock_irqsave()

It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. As the comment of dev_kfree_skb_irq() says, kfree_skb() can be replaced with dev_kfree_skb_irq() under spin_lock_irqsave().

Yang Yingliang (4):
libertas_tf: don't call kfree_skb() under spin_lock_irqsave()
libertas: don't call kfree_skb() under spin_lock_irqsave() in
process_cmdrequest()
libertas: don't call kfree_skb() under spin_lock_irqsave() in
lbs_stop_iface()
libertas: don't call kfree_skb() under spin_lock_irqsave() in
lbs_mac_event_disconnected()

 drivers/net/wireless/marvell/libertas/cmdresp.c   | 2 +-
 drivers/net/wireless/marvell/libertas/if_usb.c    | 2 +-
 drivers/net/wireless/marvell/libertas/main.c      | 2 +-
 drivers/net/wireless/marvell/libertas_tf/if_usb.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 libertas_tf: don't call kfree_skb() under spin_lock_irqsave()

It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().

Fixes fc75122fabb5 ("libertas_tf: use irqsave() in USB's complete callback")
---
 drivers/net/wireless/marvell/libertas_tf/if_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/libertas_tf/if_usb.c +1 -1
index 75b5319d033f..1750f5e93de2 100644
@@ -613,7 +613,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
 	spin_lock_irqsave(&priv->driver_lock, flags);
 	memcpy(priv->cmd_resp_buff, recvbuff + MESSAGE_HEADER_LEN,
 	       recvlength - MESSAGE_HEADER_LEN);
-	kfree_skb(skb);
+	dev_kfree_skb_irq(skb);
 	lbtf_cmd_response_rx(priv);
 	spin_unlock_irqrestore(&priv->driver_lock, flags);
 }
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/4 libertas: don't call kfree_skb() under spin_lock_irqsave() in process_cmdrequest()

In reply to Yang Yingliang

It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().

Fixes a3128feef6d5 ("libertas: use irqsave() in USB's complete callback")
---
 drivers/net/wireless/marvell/libertas/if_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/libertas/if_usb.c +1 -1
index 32fdc4150b60..2240b4db8c03 100644
@@ -637,7 +637,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
 	priv->resp_len[i] = (recvlength - MESSAGE_HEADER_LEN);
 	memcpy(priv->resp_buf[i], recvbuff + MESSAGE_HEADER_LEN,
 		priv->resp_len[i]);
-	kfree_skb(skb);
+	dev_kfree_skb_irq(skb);
 	lbs_notify_command_response(priv, i);
 
 	spin_unlock_irqrestore(&priv->driver_lock, flags);
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/4 libertas: don't call kfree_skb() under spin_lock_irqsave() in lbs_stop_iface()

In reply to Yang Yingliang

It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().

Fixes d2e7b3425c47 ("libertas: disable functionality when interface is down")
---
 drivers/net/wireless/marvell/libertas/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/libertas/main.c +1 -1
index 8f5220cee112..f42d28d99763 100644
@@ -216,7 +216,7 @@ int lbs_stop_iface(struct lbs_private *priv)
 
 	spin_lock_irqsave(&priv->driver_lock, flags);
 	priv->iface_running = false;
-	kfree_skb(priv->currenttxskb);
+	dev_kfree_skb_irq(priv->currenttxskb);
 	priv->currenttxskb = NULL;
 	priv->tx_pending_len = 0;
 	spin_unlock_irqrestore(&priv->driver_lock, flags);
Signature · 1 line
2.25.1
#4 lore raw

Re: [PATCH 3/4] libertas: don't call kfree_skb() under spin_lock_irqsave() in lbs_stop_iface()

Hi,
thank you for your information.

On our website you can find email addresses of companies and people.
https://www.skymem.info

In short, it’s like Google for emails.

Best regards,
Robert,
Skymem team

Quoted 32 lines · Yang Yingliang

It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().

Fixes d2e7b3425c47 ("libertas: disable functionality when interface is down")
---
 drivers/net/wireless/marvell/libertas/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/libertas/main.c +1 -2
index 8f5220cee112..f42d28d99763 100644
@@ -216,7 +216,7 @@ int lbs_stop_iface(struct lbs_private *priv)
 
        spin_lock_irqsave(&priv->driver_lock, flags);
        priv->iface_running = false;
-       kfree_skb(priv->currenttxskb);
+       dev_kfree_skb_irq(priv->currenttxskb);
        priv->currenttxskb = NULL;
        priv->tx_pending_len = 0;
        spin_unlock_irqrestore(&priv->driver_lock, flags);
--

2.25.1

_______________________________________________
libertas-dev mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/libertas-dev

#5 lore raw

PATCH 4/4 libertas: don't call kfree_skb() under spin_lock_irqsave() in lbs_mac_event_disconnected()

In reply to Yang Yingliang

It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().

Fixes f52b041aed77 ("libertas: Add spinlock to avoid race condition")
---
 drivers/net/wireless/marvell/libertas/cmdresp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/libertas/cmdresp.c +1 -1
index cb515c5584c1..74cb7551f427 100644
@@ -48,7 +48,7 @@ void lbs_mac_event_disconnected(struct lbs_private *priv,
 
 	/* Free Tx and Rx packets */
 	spin_lock_irqsave(&priv->driver_lock, flags);
-	kfree_skb(priv->currenttxskb);
+	dev_kfree_skb_irq(priv->currenttxskb);
 	priv->currenttxskb = NULL;
 	priv->tx_pending_len = 0;
 	spin_unlock_irqrestore(&priv->driver_lock, flags);
Signature · 1 line
2.25.1
#6 lore raw

Re: [PATCH 4/4] libertas: don't call kfree_skb() under spin_lock_irqsave() in lbs_mac_event_disconnected()

Hi,
thank you for your information.

On our website you can find email addresses of companies and people.
https://www.skymem.info

In short, it’s like Google for emails.

Best regards,
Robert,
Skymem team

Quoted 32 lines · Yang Yingliang

It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().

Fixes f52b041aed77 ("libertas: Add spinlock to avoid race condition")
---
 drivers/net/wireless/marvell/libertas/cmdresp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/libertas/cmdresp.c +1 -2
index cb515c5584c1..74cb7551f427 100644
@@ -48,7 +48,7 @@ void lbs_mac_event_disconnected(struct lbs_private *priv,
 
        /* Free Tx and Rx packets */
        spin_lock_irqsave(&priv->driver_lock, flags);
-       kfree_skb(priv->currenttxskb);
+       dev_kfree_skb_irq(priv->currenttxskb);
        priv->currenttxskb = NULL;
        priv->tx_pending_len = 0;
        spin_unlock_irqrestore(&priv->driver_lock, flags);
--

2.25.1

_______________________________________________
libertas-dev mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/libertas-dev