Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: st_core: Do not call kfree_skb() under spin_lock_irqsave()

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

Fixes: 53618cc1e51e ("Staging: sources for ST core")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20230823035020.1281892-1-ruanjinjie@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jinjie Ruan and committed by
Greg Kroah-Hartman
4d08c3d1 0113a99b

+4 -3
+4 -3
drivers/misc/ti-st/st_core.c
··· 15 15 #include <linux/skbuff.h> 16 16 17 17 #include <linux/ti_wilink_st.h> 18 + #include <linux/netdevice.h> 18 19 19 20 /* 20 21 * function pointer pointing to either, ··· 430 429 case ST_LL_AWAKE_TO_ASLEEP: 431 430 pr_err("ST LL is illegal state(%ld)," 432 431 "purging received skb.", st_ll_getstate(st_gdata)); 433 - kfree_skb(skb); 432 + dev_kfree_skb_irq(skb); 434 433 break; 435 434 case ST_LL_ASLEEP: 436 435 skb_queue_tail(&st_gdata->tx_waitq, skb); ··· 439 438 default: 440 439 pr_err("ST LL is illegal state(%ld)," 441 440 "purging received skb.", st_ll_getstate(st_gdata)); 442 - kfree_skb(skb); 441 + dev_kfree_skb_irq(skb); 443 442 break; 444 443 } 445 444 ··· 493 492 spin_unlock_irqrestore(&st_data->lock, flags); 494 493 break; 495 494 } 496 - kfree_skb(skb); 495 + dev_kfree_skb_irq(skb); 497 496 spin_unlock_irqrestore(&st_data->lock, flags); 498 497 } 499 498 /* if wake-up is set in another context- restart sending */