All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org,
	robin@protonic.nl, linux@rempel-privat.de, kernel@pengutronix.de,
	socketcan@hartkopp.net
Subject: Re: [PATCH] can: j1939: transport: replace kfree_skb() with dev_kfree_skb_irq()
Date: Thu, 27 Oct 2022 10:06:29 +0200	[thread overview]
Message-ID: <20221027080629.mn6hhdg56d4achwl@pengutronix.de> (raw)
In-Reply-To: <20221026125354.911575-1-yangyingliang@huawei.com>

[-- 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 --]

      reply	other threads:[~2022-10-27  8:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221027080629.mn6hhdg56d4achwl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=linux@rempel-privat.de \
    --cc=netdev@vger.kernel.org \
    --cc=robin@protonic.nl \
    --cc=socketcan@hartkopp.net \
    --cc=yangyingliang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.