All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Dario Binacchi <dario.binacchi@amarulasolutions.com>,
	linux-kernel@vger.kernel.org
Cc: lkp@lists.01.org, Jeroen Hofstee <jhofstee@victronenergy.com>,
	lkp@intel.com, kernel test robot <oliver.sang@intel.com>,
	Richard Palethorpe <rpalethorpe@suse.de>,
	Linux Memory Management List <linux-mm@kvack.org>,
	ltp@lists.linux.it, "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	Paolo Abeni <pabeni@redhat.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
	Wolfgang Grandegger <wg@grandegger.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v2] can: slcan: do not sleep with a spin lock held
Date: Thu, 14 Jul 2022 12:38:03 +0200	[thread overview]
Message-ID: <78cd3375-e95e-51b2-bf89-bad645e16ea4@kernel.org> (raw)
In-Reply-To: <20220713154458.253076-1-dario.binacchi@amarulasolutions.com>

On 13. 07. 22, 17:44, Dario Binacchi wrote:
> We can't call close_candev() with a spin lock held, so release the lock
> before calling it.
> 
> Fixes: c4e54b063f42f ("can: slcan: use CAN network device driver API")
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Link: https://lore.kernel.org/linux-kernel/Ysrf1Yc5DaRGN1WE@xsang-OptiPlex-9020/
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> 
> ---
> 
> Changes in v2:
> - Release the lock just before calling the close_candev().
> 
>   drivers/net/can/slcan/slcan-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c
> index 54d29a410ad5..5214421dedf3 100644
> --- a/drivers/net/can/slcan/slcan-core.c
> +++ b/drivers/net/can/slcan/slcan-core.c
> @@ -689,6 +689,7 @@ static int slc_close(struct net_device *dev)
>   		clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
>   	}
>   	netif_stop_queue(dev);
> +	spin_unlock_bh(&sl->lock);
>   	close_candev(dev);
>   	sl->can.state = CAN_STATE_STOPPED;
>   	if (sl->can.bittiming.bitrate == CAN_BITRATE_UNKNOWN)
> @@ -696,7 +697,6 @@ static int slc_close(struct net_device *dev)
>   
>   	sl->rcount   = 0;
>   	sl->xleft    = 0;

So all these sets need not be under the spinlock?

If so, you should explain why in the commit message.

> -	spin_unlock_bh(&sl->lock);
>   
>   	return 0;
>   }

thanks,
-- 
js
suse labs

WARNING: multiple messages have this Message-ID (diff)
From: Jiri Slaby <jirislaby@kernel.org>
To: Dario Binacchi <dario.binacchi@amarulasolutions.com>,
	linux-kernel@vger.kernel.org
Cc: lkp@intel.com, Linux Memory Management List <linux-mm@kvack.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jeroen Hofstee <jhofstee@victronenergy.com>,
	linux-can@vger.kernel.org, lkp@lists.01.org,
	Eric Dumazet <edumazet@google.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	kernel test robot <oliver.sang@intel.com>,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
	netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	ltp@lists.linux.it, Wolfgang Grandegger <wg@grandegger.com>
Subject: Re: [LTP] [PATCH v2] can: slcan: do not sleep with a spin lock held
Date: Thu, 14 Jul 2022 12:38:03 +0200	[thread overview]
Message-ID: <78cd3375-e95e-51b2-bf89-bad645e16ea4@kernel.org> (raw)
In-Reply-To: <20220713154458.253076-1-dario.binacchi@amarulasolutions.com>

On 13. 07. 22, 17:44, Dario Binacchi wrote:
> We can't call close_candev() with a spin lock held, so release the lock
> before calling it.
> 
> Fixes: c4e54b063f42f ("can: slcan: use CAN network device driver API")
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Link: https://lore.kernel.org/linux-kernel/Ysrf1Yc5DaRGN1WE@xsang-OptiPlex-9020/
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> 
> ---
> 
> Changes in v2:
> - Release the lock just before calling the close_candev().
> 
>   drivers/net/can/slcan/slcan-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c
> index 54d29a410ad5..5214421dedf3 100644
> --- a/drivers/net/can/slcan/slcan-core.c
> +++ b/drivers/net/can/slcan/slcan-core.c
> @@ -689,6 +689,7 @@ static int slc_close(struct net_device *dev)
>   		clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
>   	}
>   	netif_stop_queue(dev);
> +	spin_unlock_bh(&sl->lock);
>   	close_candev(dev);
>   	sl->can.state = CAN_STATE_STOPPED;
>   	if (sl->can.bittiming.bitrate == CAN_BITRATE_UNKNOWN)
> @@ -696,7 +697,6 @@ static int slc_close(struct net_device *dev)
>   
>   	sl->rcount   = 0;
>   	sl->xleft    = 0;

So all these sets need not be under the spinlock?

If so, you should explain why in the commit message.

> -	spin_unlock_bh(&sl->lock);
>   
>   	return 0;
>   }

thanks,
-- 
js
suse labs

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

WARNING: multiple messages have this Message-ID (diff)
From: Jiri Slaby <jirislaby@kernel.org>
To: lkp@lists.01.org
Subject: Re: [PATCH v2] can: slcan: do not sleep with a spin lock held
Date: Thu, 14 Jul 2022 12:38:03 +0200	[thread overview]
Message-ID: <78cd3375-e95e-51b2-bf89-bad645e16ea4@kernel.org> (raw)
In-Reply-To: <20220713154458.253076-1-dario.binacchi@amarulasolutions.com>

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

On 13. 07. 22, 17:44, Dario Binacchi wrote:
> We can't call close_candev() with a spin lock held, so release the lock
> before calling it.
> 
> Fixes: c4e54b063f42f ("can: slcan: use CAN network device driver API")
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Link: https://lore.kernel.org/linux-kernel/Ysrf1Yc5DaRGN1WE(a)xsang-OptiPlex-9020/
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> 
> ---
> 
> Changes in v2:
> - Release the lock just before calling the close_candev().
> 
>   drivers/net/can/slcan/slcan-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c
> index 54d29a410ad5..5214421dedf3 100644
> --- a/drivers/net/can/slcan/slcan-core.c
> +++ b/drivers/net/can/slcan/slcan-core.c
> @@ -689,6 +689,7 @@ static int slc_close(struct net_device *dev)
>   		clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
>   	}
>   	netif_stop_queue(dev);
> +	spin_unlock_bh(&sl->lock);
>   	close_candev(dev);
>   	sl->can.state = CAN_STATE_STOPPED;
>   	if (sl->can.bittiming.bitrate == CAN_BITRATE_UNKNOWN)
> @@ -696,7 +697,6 @@ static int slc_close(struct net_device *dev)
>   
>   	sl->rcount   = 0;
>   	sl->xleft    = 0;

So all these sets need not be under the spinlock?

If so, you should explain why in the commit message.

> -	spin_unlock_bh(&sl->lock);
>   
>   	return 0;
>   }

thanks,
-- 
js
suse labs

  reply	other threads:[~2022-07-14 10:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 15:44 [PATCH v2] can: slcan: do not sleep with a spin lock held Dario Binacchi
2022-07-13 15:44 ` Dario Binacchi
2022-07-13 15:44 ` [LTP] " Dario Binacchi
2022-07-14 10:38 ` Jiri Slaby [this message]
2022-07-14 10:38   ` Jiri Slaby
2022-07-14 10:38   ` [LTP] " Jiri Slaby

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=78cd3375-e95e-51b2-bf89-bad645e16ea4@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhofstee@victronenergy.com \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=lkp@lists.01.org \
    --cc=ltp@lists.linux.it \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=oliver.sang@intel.com \
    --cc=pabeni@redhat.com \
    --cc=rpalethorpe@suse.de \
    --cc=wg@grandegger.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.