[28/81] rapidio/rionet: fix deadlock on SMP

Message ID 56f1b856.XHFOKhdGSeAPabdz%akpm@linux-foundation.org
State New
Headers show

Commit Message

Andrew Morton March 22, 2016, 9:25 p.m.
From: Aurelien Jacquiot <a-jacquiot@ti.com>

Subject: rapidio/rionet: fix deadlock on SMP

Fix deadlocking during concurrent receive and transmit operations on SMP
platforms caused by the use of incorrect lock: on transmit 'tx_lock'
spinlock should be used instead of 'lock' which is used for receive

This fix is applicable to kernel versions starting from v2.15.

Signed-off-by: Aurelien Jacquiot <a-jacquiot@ti.com>

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>

Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


 drivers/net/rionet.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


diff -puN drivers/net/rionet.c~rapidio-rionet-fix-deadlock-on-smp drivers/net/rionet.c
--- a/drivers/net/rionet.c~rapidio-rionet-fix-deadlock-on-smp
+++ a/drivers/net/rionet.c
@@ -280,7 +280,7 @@  static void rionet_outb_msg_event(struct
 	struct net_device *ndev = dev_id;
 	struct rionet_private *rnet = netdev_priv(ndev);
-	spin_lock(&rnet->lock);
+	spin_lock(&rnet->tx_lock);
 	if (netif_msg_intr(rnet))
@@ -299,7 +299,7 @@  static void rionet_outb_msg_event(struct
 	if (rnet->tx_cnt < RIONET_TX_RING_SIZE)
-	spin_unlock(&rnet->lock);
+	spin_unlock(&rnet->tx_lock);
 static int rionet_open(struct net_device *ndev)