All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/3] mISDN: don't call dev_kfree_skb() under spin_lock_irqsave()
@ 2022-12-07  9:32 Yang Yingliang
  2022-12-07  9:32 ` [PATCH net 1/3] mISDN: hfcsusb: " Yang Yingliang
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Yang Yingliang @ 2022-12-07  9:32 UTC (permalink / raw)
  To: netdev; +Cc: isdn, davem

It is not allowed to call consume_skb() from hardware interrupt context
or with interrupts being disabled. This patchset replace dev_kfree_skb()
with dev_consume_skb_irq() under spin_lock_irqsave().

Yang Yingliang (3):
  mISDN: hfcsusb: don't call dev_kfree_skb() under spin_lock_irqsave()
  mISDN: hfcpci: don't call dev_kfree_skb() under spin_lock_irqsave()
  mISDN: hfcmulti: don't call dev_kfree_skb() under spin_lock_irqsave()

 drivers/isdn/hardware/mISDN/hfcmulti.c | 8 ++++----
 drivers/isdn/hardware/mISDN/hfcpci.c   | 4 ++--
 drivers/isdn/hardware/mISDN/hfcsusb.c  | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net 1/3] mISDN: hfcsusb: don't call dev_kfree_skb() under spin_lock_irqsave()
  2022-12-07  9:32 [PATCH net 0/3] mISDN: don't call dev_kfree_skb() under spin_lock_irqsave() Yang Yingliang
@ 2022-12-07  9:32 ` Yang Yingliang
  2022-12-07 14:54   ` Jiri Pirko
  2022-12-09 23:57   ` Jakub Kicinski
  2022-12-07  9:32 ` [PATCH net 2/3] mISDN: hfcpci: " Yang Yingliang
  2022-12-07  9:32 ` [PATCH net 3/3] mISDN: hfcmulti: " Yang Yingliang
  2 siblings, 2 replies; 9+ messages in thread
From: Yang Yingliang @ 2022-12-07  9:32 UTC (permalink / raw)
  To: netdev; +Cc: isdn, davem

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

Fixes: 69f52adb2d53 ("mISDN: Add HFC USB driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/isdn/hardware/mISDN/hfcsusb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 651f2f8f685b..9659ebeb99f0 100644
--- a/drivers/isdn/hardware/mISDN/hfcsusb.c
+++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
@@ -330,12 +330,12 @@ hfcusb_l2l1D(struct mISDNchannel *ch, struct sk_buff *skb)
 			spin_lock_irqsave(&hw->lock, flags);
 			skb_queue_purge(&dch->squeue);
 			if (dch->tx_skb) {
-				dev_kfree_skb(dch->tx_skb);
+				dev_consume_skb_irq(dch->tx_skb);
 				dch->tx_skb = NULL;
 			}
 			dch->tx_idx = 0;
 			if (dch->rx_skb) {
-				dev_kfree_skb(dch->rx_skb);
+				dev_consume_skb_irq(dch->rx_skb);
 				dch->rx_skb = NULL;
 			}
 			test_and_clear_bit(FLG_TX_BUSY, &dch->Flags);
@@ -1330,7 +1330,7 @@ tx_iso_complete(struct urb *urb)
 					printk("\n");
 				}
 
-				dev_kfree_skb(tx_skb);
+				dev_consume_skb_irq(tx_skb);
 				tx_skb = NULL;
 				if (fifo->dch && get_next_dframe(fifo->dch))
 					tx_skb = fifo->dch->tx_skb;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net 2/3] mISDN: hfcpci: don't call dev_kfree_skb() under spin_lock_irqsave()
  2022-12-07  9:32 [PATCH net 0/3] mISDN: don't call dev_kfree_skb() under spin_lock_irqsave() Yang Yingliang
  2022-12-07  9:32 ` [PATCH net 1/3] mISDN: hfcsusb: " Yang Yingliang
@ 2022-12-07  9:32 ` Yang Yingliang
  2022-12-07 14:58   ` Jiri Pirko
  2022-12-07  9:32 ` [PATCH net 3/3] mISDN: hfcmulti: " Yang Yingliang
  2 siblings, 1 reply; 9+ messages in thread
From: Yang Yingliang @ 2022-12-07  9:32 UTC (permalink / raw)
  To: netdev; +Cc: isdn, davem

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

Fixes: 1700fe1a10dc ("Add mISDN HFC PCI driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/isdn/hardware/mISDN/hfcpci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index e964a8dd8512..84b8806b4a8f 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -1621,12 +1621,12 @@ hfcpci_l2l1D(struct mISDNchannel *ch, struct sk_buff *skb)
 			Write_hfc(hc, HFCPCI_STATES, 0x40);
 			skb_queue_purge(&dch->squeue);
 			if (dch->tx_skb) {
-				dev_kfree_skb(dch->tx_skb);
+				dev_consume_skb_irq(dch->tx_skb);
 				dch->tx_skb = NULL;
 			}
 			dch->tx_idx = 0;
 			if (dch->rx_skb) {
-				dev_kfree_skb(dch->rx_skb);
+				dev_consume_skb_irq(dch->rx_skb);
 				dch->rx_skb = NULL;
 			}
 			test_and_clear_bit(FLG_TX_BUSY, &dch->Flags);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net 3/3] mISDN: hfcmulti: don't call dev_kfree_skb() under spin_lock_irqsave()
  2022-12-07  9:32 [PATCH net 0/3] mISDN: don't call dev_kfree_skb() under spin_lock_irqsave() Yang Yingliang
  2022-12-07  9:32 ` [PATCH net 1/3] mISDN: hfcsusb: " Yang Yingliang
  2022-12-07  9:32 ` [PATCH net 2/3] mISDN: hfcpci: " Yang Yingliang
@ 2022-12-07  9:32 ` Yang Yingliang
  2022-12-07 14:59   ` Jiri Pirko
  2 siblings, 1 reply; 9+ messages in thread
From: Yang Yingliang @ 2022-12-07  9:32 UTC (permalink / raw)
  To: netdev; +Cc: isdn, davem

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

Fixes: af69fb3a8ffa ("Add mISDN HFC multiport driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/isdn/hardware/mISDN/hfcmulti.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index 4f7eaa17fb27..9f932cbb2a20 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -3266,12 +3266,12 @@ hfcm_l1callback(struct dchannel *dch, u_int cmd)
 		}
 		skb_queue_purge(&dch->squeue);
 		if (dch->tx_skb) {
-			dev_kfree_skb(dch->tx_skb);
+			dev_consume_skb_irq(dch->tx_skb);
 			dch->tx_skb = NULL;
 		}
 		dch->tx_idx = 0;
 		if (dch->rx_skb) {
-			dev_kfree_skb(dch->rx_skb);
+			dev_consume_skb_irq(dch->rx_skb);
 			dch->rx_skb = NULL;
 		}
 		test_and_clear_bit(FLG_TX_BUSY, &dch->Flags);
@@ -3407,12 +3407,12 @@ handle_dmsg(struct mISDNchannel *ch, struct sk_buff *skb)
 			}
 			skb_queue_purge(&dch->squeue);
 			if (dch->tx_skb) {
-				dev_kfree_skb(dch->tx_skb);
+				dev_consume_skb_irq(dch->tx_skb);
 				dch->tx_skb = NULL;
 			}
 			dch->tx_idx = 0;
 			if (dch->rx_skb) {
-				dev_kfree_skb(dch->rx_skb);
+				dev_consume_skb_irq(dch->rx_skb);
 				dch->rx_skb = NULL;
 			}
 			test_and_clear_bit(FLG_TX_BUSY, &dch->Flags);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net 1/3] mISDN: hfcsusb: don't call dev_kfree_skb() under spin_lock_irqsave()
  2022-12-07  9:32 ` [PATCH net 1/3] mISDN: hfcsusb: " Yang Yingliang
@ 2022-12-07 14:54   ` Jiri Pirko
  2022-12-09 23:57   ` Jakub Kicinski
  1 sibling, 0 replies; 9+ messages in thread
From: Jiri Pirko @ 2022-12-07 14:54 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: netdev, isdn, davem

Wed, Dec 07, 2022 at 10:32:37AM CET, yangyingliang@huawei.com wrote:
>It is not allowed to call consume_skb() from hardware interrupt context
>or with interrupts being disabled. So replace dev_kfree_skb() with
>dev_consume_skb_irq() under spin_lock_irqsave().
>
>Fixes: 69f52adb2d53 ("mISDN: Add HFC USB driver")
>Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 2/3] mISDN: hfcpci: don't call dev_kfree_skb() under spin_lock_irqsave()
  2022-12-07  9:32 ` [PATCH net 2/3] mISDN: hfcpci: " Yang Yingliang
@ 2022-12-07 14:58   ` Jiri Pirko
  0 siblings, 0 replies; 9+ messages in thread
From: Jiri Pirko @ 2022-12-07 14:58 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: netdev, isdn, davem

Wed, Dec 07, 2022 at 10:32:38AM CET, yangyingliang@huawei.com wrote:
>It is not allowed to call consume_skb() from hardware interrupt context
>or with interrupts being disabled. So replace dev_kfree_skb() with
>dev_consume_skb_irq() under spin_lock_irqsave().
>
>Fixes: 1700fe1a10dc ("Add mISDN HFC PCI driver")
>Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 3/3] mISDN: hfcmulti: don't call dev_kfree_skb() under spin_lock_irqsave()
  2022-12-07  9:32 ` [PATCH net 3/3] mISDN: hfcmulti: " Yang Yingliang
@ 2022-12-07 14:59   ` Jiri Pirko
  0 siblings, 0 replies; 9+ messages in thread
From: Jiri Pirko @ 2022-12-07 14:59 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: netdev, isdn, davem

Wed, Dec 07, 2022 at 10:32:39AM CET, yangyingliang@huawei.com wrote:
>It is not allowed to call consume_skb() from hardware interrupt context
>or with interrupts being disabled. So replace dev_kfree_skb() with
>dev_consume_skb_irq() under spin_lock_irqsave().
>
>Fixes: af69fb3a8ffa ("Add mISDN HFC multiport driver")
>Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 1/3] mISDN: hfcsusb: don't call dev_kfree_skb() under spin_lock_irqsave()
  2022-12-07  9:32 ` [PATCH net 1/3] mISDN: hfcsusb: " Yang Yingliang
  2022-12-07 14:54   ` Jiri Pirko
@ 2022-12-09 23:57   ` Jakub Kicinski
  2022-12-12  1:58     ` Yang Yingliang
  1 sibling, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2022-12-09 23:57 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: netdev, isdn, davem

On Wed, 7 Dec 2022 17:32:37 +0800 Yang Yingliang wrote:
>  			spin_lock_irqsave(&hw->lock, flags);
>  			skb_queue_purge(&dch->squeue);

Please take a look at what skb_queue_purge() does.
Perhaps you should create a skb_buff_head on the stack,
skb_queue_splice_init() from the sch->squeue onto that
queue, add the rx_skb and tx_skb into that queue,
then drop the lock and skb_queue_purge() outside the lock.

>  			if (dch->tx_skb) {
> -				dev_kfree_skb(dch->tx_skb);
> +				dev_consume_skb_irq(dch->tx_skb);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 1/3] mISDN: hfcsusb: don't call dev_kfree_skb() under spin_lock_irqsave()
  2022-12-09 23:57   ` Jakub Kicinski
@ 2022-12-12  1:58     ` Yang Yingliang
  0 siblings, 0 replies; 9+ messages in thread
From: Yang Yingliang @ 2022-12-12  1:58 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, isdn, davem


On 2022/12/10 7:57, Jakub Kicinski wrote:
> On Wed, 7 Dec 2022 17:32:37 +0800 Yang Yingliang wrote:
>>   			spin_lock_irqsave(&hw->lock, flags);
>>   			skb_queue_purge(&dch->squeue);
> Please take a look at what skb_queue_purge() does.
> Perhaps you should create a skb_buff_head on the stack,
> skb_queue_splice_init() from the sch->squeue onto that
> queue, add the rx_skb and tx_skb into that queue,
> then drop the lock and skb_queue_purge() outside the lock.
skb_queue_purge() calls kfree_skb() which is not allowed in this
case, I will send a v2 to change it.

Thanks,
Yang
>
>>   			if (dch->tx_skb) {
>> -				dev_kfree_skb(dch->tx_skb);
>> +				dev_consume_skb_irq(dch->tx_skb);
> .

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-12-12  1:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07  9:32 [PATCH net 0/3] mISDN: don't call dev_kfree_skb() under spin_lock_irqsave() Yang Yingliang
2022-12-07  9:32 ` [PATCH net 1/3] mISDN: hfcsusb: " Yang Yingliang
2022-12-07 14:54   ` Jiri Pirko
2022-12-09 23:57   ` Jakub Kicinski
2022-12-12  1:58     ` Yang Yingliang
2022-12-07  9:32 ` [PATCH net 2/3] mISDN: hfcpci: " Yang Yingliang
2022-12-07 14:58   ` Jiri Pirko
2022-12-07  9:32 ` [PATCH net 3/3] mISDN: hfcmulti: " Yang Yingliang
2022-12-07 14:59   ` Jiri Pirko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.