can: j1939: transport: replace kfree_skb() with dev_kfree_skb_irq()
Subsystems (5)
PATCH v2 1/1 can: j1939: transport: replace kfree_skb() with dev_kfree_skb_irq()
It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. The skb is unlinked from the queue, so it can be freed after spin_unlock_irqrestore().
Fixes 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
Signed-off-by Yang Yingliang <[email protected]>
---
v1 -> v2:
Move kfree_skb() after spin_unlock_irqrestore().
--- net/can/j1939/transport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/can/j1939/transport.c +3 -1
@@ -342,10 +342,12 @@ static void j1939_session_skb_drop_old(struct j1939_session *session)__skb_unlink (do_skb, &session->skb_queue);/* drop ref taken in j1939_session_skb_queue() */ skb_unref (do_skb); +spin_unlock_irqrestore (&session->skb_queue.lock, flags);kfree_skb (do_skb); + }else { +spin_unlock_irqrestore (&session->skb_queue.lock, flags); } -spin_unlock_irqrestore (&session->skb_queue.lock, flags); } void j1939_session_skb_queue(struct j1939_session *session,
Signature · 1 line
2.25.1
Quoted 6 lines · Yang Yingliang
It is not allowed to call
kfree_skb()from hardware interrupt context or with interrupts being disabled. The skb is unlinked from the queue, so it can be freed afterspin_unlock_irqrestore().Fixes 9d71dd0c7009 ("can: add support of SAE J1939 protocol")Signed-off-by Yang Yingliang <[email protected]>
Acked-by Oleksij Rempel <[email protected]>
Quoted 29 lines
---
v1 -> v2:
Movekfree_skb()afterspin_unlock_irqrestore().--- net/can/j1939/transport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)net/can/j1939/transport.c +3
-1@@ -342,10 +342,12 @@ static void j1939_session_skb_drop_old(struct j1939_session *session)__skb_unlink (do_skb, &session->skb_queue);/* drop ref taken in j1939_session_skb_queue() */ skb_unref (do_skb); +spin_unlock_irqrestore (&session->skb_queue.lock, flags);kfree_skb (do_skb); + }else { +spin_unlock_irqrestore (&session->skb_queue.lock, flags); } -spin_unlock_irqrestore (&session->skb_queue.lock, flags); } void j1939_session_skb_queue(struct j1939_session *session,Signature · 1 line
2.25.1
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |