All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: David Miller <davem@davemloft.net>
Cc: Andre Naujoks <nautsch2@gmail.com>,
	Linux Netdev List <netdev@vger.kernel.org>,
	linux-can@vger.kernel.org,
	Alexander Stein <alexander.stein@systec-electronic.com>
Subject: [PATCH] slip: fix spinlock variant
Date: Sat, 26 Apr 2014 21:18:32 +0200	[thread overview]
Message-ID: <535C0688.604@hartkopp.net> (raw)
In-Reply-To: <534D3748.6060602@pengutronix.de>

With commit cc9fa74e2a ("slip/slcan: added locking in wakeup function") a
formerly missing locking was added to slip.c and slcan.c by Andre Naujoks.

Alexander Stein contributed the fix 367525c8c2 ("can: slcan: Fix spinlock
variant") as the kernel lock debugging advised to use spin_lock_bh() instead
of just using spin_lock().

This fix has to be applied to the same code section in slip.c for the same
reason too.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

---

diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
index cc70ecf..ad4a94e 100644
--- a/drivers/net/slip/slip.c
+++ b/drivers/net/slip/slip.c
@@ -429,13 +429,13 @@ static void slip_write_wakeup(struct tty_struct *tty)
 	if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev))
 		return;
 
-	spin_lock(&sl->lock);
+	spin_lock_bh(&sl->lock);
 	if (sl->xleft <= 0)  {
 		/* Now serial buffer is almost free & we can start
 		 * transmission of another packet */
 		sl->dev->stats.tx_packets++;
 		clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
-		spin_unlock(&sl->lock);
+		spin_unlock_bh(&sl->lock);
 		sl_unlock(sl);
 		return;
 	}
@@ -443,7 +443,7 @@ static void slip_write_wakeup(struct tty_struct *tty)
 	actual = tty->ops->write(tty, sl->xhead, sl->xleft);
 	sl->xleft -= actual;
 	sl->xhead += actual;
-	spin_unlock(&sl->lock);
+	spin_unlock_bh(&sl->lock);
 }
 
 static void sl_tx_timeout(struct net_device *dev)




  parent reply	other threads:[~2014-04-26 19:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA+s8ZrqFBun4bo2rJJFHb0FrV7m7PLybUVM+jjahKsdW8bdnaQ@mail.gmail.com>
2014-04-15  9:55 ` Problem with Eurotech COM1273 Dual Channel CAN PC104 Module Wolfgang Grandegger
2014-04-15 10:50   ` Oliver Hartkopp
     [not found]     ` <CA+s8ZroY7j8MLpFQh568QdeB24zBwVAVXbi7RzQF+baFi+Mpkw@mail.gmail.com>
2014-04-15 11:55       ` Oliver Hartkopp
     [not found]     ` <CA+s8Zrqrd_U0g1GRCDzXncgWLA_kO3Hyhjwy6Oe1S0cYohm2og@mail.gmail.com>
2014-04-15 12:00       ` Oliver Hartkopp
2014-04-15 12:33         ` Marc Kleine-Budde
2014-04-15 13:19           ` Oliver Hartkopp
2014-04-15 13:42             ` Marc Kleine-Budde
2014-04-15 17:30               ` [PATCH] can: sja1000_isa: add locking for indirect register access mode Oliver Hartkopp
2014-04-15 21:26                 ` Thomas Gleixner
2014-04-15 21:49                   ` Marc Kleine-Budde
2014-04-16  8:48                     ` Thomas Gleixner
2014-04-17 19:23                 ` Marc Kleine-Budde
2014-04-21 17:39                 ` Oliver Hartkopp
     [not found]                   ` <CA+s8ZroSGpijgG4ruk2T1V5Vp1WrCcVjVPPrqGU-rQSDEUxzXg@mail.gmail.com>
2014-04-24 11:41                     ` Oliver Hartkopp
2014-04-26 19:18               ` Oliver Hartkopp [this message]
2014-04-28  3:35                 ` [PATCH] slip: fix spinlock variant David Miller

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=535C0688.604@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=alexander.stein@systec-electronic.com \
    --cc=davem@davemloft.net \
    --cc=linux-can@vger.kernel.org \
    --cc=nautsch2@gmail.com \
    --cc=netdev@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 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.