netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Ronald Wahl <rwahl@gmx.de>
Cc: Ronald Wahl <ronald.wahl@raritan.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] net: ks8851: Fix deadlock with the SPI chip variant
Date: Fri, 5 Jul 2024 17:39:31 -0700	[thread overview]
Message-ID: <20240705173931.28e8b858@kernel.org> (raw)
In-Reply-To: <20240704174756.1225995-1-rwahl@gmx.de>

On Thu,  4 Jul 2024 19:47:56 +0200 Ronald Wahl wrote:
> --- a/drivers/net/ethernet/micrel/ks8851_spi.c
> +++ b/drivers/net/ethernet/micrel/ks8851_spi.c
> @@ -385,7 +385,7 @@ static netdev_tx_t ks8851_start_xmit_spi(struct sk_buff *skb,
>  	netif_dbg(ks, tx_queued, ks->netdev,
>  		  "%s: skb %p, %d@%p\n", __func__, skb, skb->len, skb->data);
> 
> -	spin_lock(&ks->statelock);
> +	spin_lock_bh(&ks->statelock);
> 
>  	if (ks->queued_len + needed > ks->tx_space) {
>  		netif_stop_queue(dev);
> @@ -395,7 +395,7 @@ static netdev_tx_t ks8851_start_xmit_spi(struct sk_buff *skb,
>  		skb_queue_tail(&ks->txq, skb);
>  	}
> 
> -	spin_unlock(&ks->statelock);
> +	spin_unlock_bh(&ks->statelock);

this one probably can stay as spin_lock() since networking stack only
calls xmit in BH context. But I see 2 other spin_lock(statelock) in the
driver which I'm not as sure about. Any taking of this lock has to be
_bh() unless you're sure the caller is already in BH.

  reply	other threads:[~2024-07-06  0:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 17:47 [PATCH v2] net: ks8851: Fix deadlock with the SPI chip variant Ronald Wahl
2024-07-06  0:39 ` Jakub Kicinski [this message]
2024-07-06  8:38   ` Ronald Wahl
2024-07-06  9:22     ` Ronald Wahl
2024-07-06  9:27       ` Greg KH

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=20240705173931.28e8b858@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ronald.wahl@raritan.com \
    --cc=rwahl@gmx.de \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).