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

[ Upstream commit 4d08c3d12b61022501989f9f071514d2d6f77c47 ]

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: 53618cc1e5 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Jinjie Ruan 2023-08-23 11:50:20 +08:00 committed by Greg Kroah-Hartman
parent 84f254d901
commit d2ab1ff309
1 changed files with 4 additions and 3 deletions

View File

@ -15,6 +15,7 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/ti_wilink_st.h> #include <linux/ti_wilink_st.h>
#include <linux/netdevice.h>
/* /*
* function pointer pointing to either, * function pointer pointing to either,
@ -429,7 +430,7 @@ static void st_int_enqueue(struct st_data_s *st_gdata, struct sk_buff *skb)
case ST_LL_AWAKE_TO_ASLEEP: case ST_LL_AWAKE_TO_ASLEEP:
pr_err("ST LL is illegal state(%ld)," pr_err("ST LL is illegal state(%ld),"
"purging received skb.", st_ll_getstate(st_gdata)); "purging received skb.", st_ll_getstate(st_gdata));
kfree_skb(skb); dev_kfree_skb_irq(skb);
break; break;
case ST_LL_ASLEEP: case ST_LL_ASLEEP:
skb_queue_tail(&st_gdata->tx_waitq, skb); skb_queue_tail(&st_gdata->tx_waitq, skb);
@ -438,7 +439,7 @@ static void st_int_enqueue(struct st_data_s *st_gdata, struct sk_buff *skb)
default: default:
pr_err("ST LL is illegal state(%ld)," pr_err("ST LL is illegal state(%ld),"
"purging received skb.", st_ll_getstate(st_gdata)); "purging received skb.", st_ll_getstate(st_gdata));
kfree_skb(skb); dev_kfree_skb_irq(skb);
break; break;
} }
@ -492,7 +493,7 @@ void st_tx_wakeup(struct st_data_s *st_data)
spin_unlock_irqrestore(&st_data->lock, flags); spin_unlock_irqrestore(&st_data->lock, flags);
break; break;
} }
kfree_skb(skb); dev_kfree_skb_irq(skb);
spin_unlock_irqrestore(&st_data->lock, flags); spin_unlock_irqrestore(&st_data->lock, flags);
} }
/* if wake-up is set in another context- restart sending */ /* if wake-up is set in another context- restart sending */