diff mbox series

[net,1/3] mISDN: hfcsusb: don't call dev_kfree_skb() under spin_lock_irqsave()

Message ID 20221207093239.3775457-2-yangyingliang@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series mISDN: don't call dev_kfree_skb() under spin_lock_irqsave() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 1 blamed authors not CCed: m.bachem@gmx.de; 3 maintainers not CCed: m.bachem@gmx.de jiangjian@cdjrlc.com kuba@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 22 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yang Yingliang Dec. 7, 2022, 9:32 a.m. UTC
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(-)

Comments

Jiri Pirko Dec. 7, 2022, 2:54 p.m. UTC | #1
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>
Jakub Kicinski Dec. 9, 2022, 11:57 p.m. UTC | #2
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);
Yang Yingliang Dec. 12, 2022, 1:58 a.m. UTC | #3
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);
> .
diff mbox series

Patch

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;