All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] can: j1939: transport: replace kfree_skb() with dev_kfree_skb_irq()
@ 2022-10-26 12:53 Yang Yingliang
  2022-10-27  8:06 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-10-26 12:53 UTC (permalink / raw)
  To: linux-can, netdev; +Cc: robin, linux, kernel, socketcan, mkl

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

Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 net/can/j1939/transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index d7d86c944d76..b95fb759c49d 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -343,7 +343,7 @@ static void j1939_session_skb_drop_old(struct j1939_session *session)
 		/* drop ref taken in j1939_session_skb_queue() */
 		skb_unref(do_skb);
 
-		kfree_skb(do_skb);
+		dev_kfree_skb_irq(do_skb);
 	}
 	spin_unlock_irqrestore(&session->skb_queue.lock, flags);
 }
-- 
2.25.1


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

* Re: [PATCH] can: j1939: transport: replace kfree_skb() with dev_kfree_skb_irq()
  2022-10-26 12:53 [PATCH] can: j1939: transport: replace kfree_skb() with dev_kfree_skb_irq() Yang Yingliang
@ 2022-10-27  8:06 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2022-10-27  8:06 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-can, netdev, robin, linux, kernel, socketcan

[-- Attachment #1: Type: text/plain, Size: 1333 bytes --]

On 26.10.2022 20:53:54, Yang Yingliang wrote:
> It is not allowed to call kfree_skb() from hardware interrupt
> context or with interrupts being disabled. So replace kfree_skb()
> with dev_kfree_skb_irq() under spin_lock_irqsave().
> 
> Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  net/can/j1939/transport.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
> index d7d86c944d76..b95fb759c49d 100644
> --- a/net/can/j1939/transport.c
> +++ b/net/can/j1939/transport.c
> @@ -343,7 +343,7 @@ static void j1939_session_skb_drop_old(struct j1939_session *session)
>  		/* drop ref taken in j1939_session_skb_queue() */
>  		skb_unref(do_skb);
>  
> -		kfree_skb(do_skb);
> +		dev_kfree_skb_irq(do_skb);

Can you call spin_unlock_irqrestore() before the kfree_skb()? Does that
fix the problem?

>  	}
>  	spin_unlock_irqrestore(&session->skb_queue.lock, flags);
>  }

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2022-10-27  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-26 12:53 [PATCH] can: j1939: transport: replace kfree_skb() with dev_kfree_skb_irq() Yang Yingliang
2022-10-27  8:06 ` Marc Kleine-Budde

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.