diff mbox

[net-2.6,2/3] jme: Adding lock to protect vlgrp structure.

Message ID 1268630108-10374-2-git-send-email-cooldavid@cooldavid.org
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Guo-Fu Tseng March 15, 2010, 5:15 a.m. UTC
From: Guo-Fu Tseng <cooldavid@cooldavid.org>

Adding a lock to prevent modifying the vlgrp structure while receiving
VLAN packet.

Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org>
---
 drivers/net/jme.c |    6 ++++++
 drivers/net/jme.h |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

Comments

David Miller March 15, 2010, 10:54 p.m. UTC | #1
Please respin this whole patch set when you fix this
vlgrp locking the way I told you to.

Also, please don't submit a seperate series for 2.6.33 it only creates
confusion.  Just add a "CC: stable@kernel.org" right after your
signoff line and it'll get sorted out automatically once the patch
reaches Linus's tree.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guo-Fu Tseng March 16, 2010, 7:49 a.m. UTC | #2
On Mon, 15 Mar 2010 15:54:53 -0700 (PDT), David Miller wrote
> Please respin this whole patch set when you fix this
> vlgrp locking the way I told you to.
> 
> Also, please don't submit a seperate series for 2.6.33 it only creates
> confusion.  Just add a "CC: stable@kernel.org" right after your
> signoff line and it'll get sorted out automatically once the patch
> reaches Linus's tree.
Now I see the "stable_kernel_rules.txt", sorry for the careless.

BTW, is it OK if the patch can only apply on net-2.6 tree cleanly,
but have some Hunks applying to stable kernel? If it is intended
for both net-2.6 and stable kernel.

Guo-Fu Tseng

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 16, 2010, 7:55 a.m. UTC | #3
From: "Guo-Fu Tseng" <cooldavid@cooldavid.org>
Date: Tue, 16 Mar 2010 15:49:45 +0800

> BTW, is it OK if the patch can only apply on net-2.6 tree cleanly,
> but have some Hunks applying to stable kernel? If it is intended
> for both net-2.6 and stable kernel.

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

Patch

diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index cfc7b98..9096bbd 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -942,11 +942,14 @@  jme_alloc_and_feed_skb(struct jme_adapter *jme, int idx)
 			skb->ip_summed = CHECKSUM_NONE;
 
 		if (rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_TAGON)) {
+			spin_lock(&jme->vlgrp_lock);
 			if (jme->vlgrp) {
 				jme->jme_vlan_rx(skb, jme->vlgrp,
 					le16_to_cpu(rxdesc->descwb.vlan));
+				spin_unlock(&jme->vlgrp_lock);
 				NET_STAT(jme).rx_bytes += 4;
 			} else {
+				spin_unlock(&jme->vlgrp_lock);
 				dev_kfree_skb(skb);
 			}
 		} else {
@@ -2088,7 +2091,9 @@  jme_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
 {
 	struct jme_adapter *jme = netdev_priv(netdev);
 
+	spin_lock_bh(&jme->vlgrp_lock);
 	jme->vlgrp = grp;
+	spin_unlock_bh(&jme->vlgrp_lock);
 }
 
 static void
@@ -2755,6 +2760,7 @@  jme_init_one(struct pci_dev *pdev,
 	spin_lock_init(&jme->phy_lock);
 	spin_lock_init(&jme->macaddr_lock);
 	spin_lock_init(&jme->rxmcs_lock);
+	spin_lock_init(&jme->vlgrp_lock);
 
 	atomic_set(&jme->link_changing, 1);
 	atomic_set(&jme->rx_cleaning, 1);
diff --git a/drivers/net/jme.h b/drivers/net/jme.h
index c19db91..0ed4924 100644
--- a/drivers/net/jme.h
+++ b/drivers/net/jme.h
@@ -393,6 +393,7 @@  struct jme_adapter {
 	spinlock_t		phy_lock;
 	spinlock_t		macaddr_lock;
 	spinlock_t		rxmcs_lock;
+	spinlock_t		vlgrp_lock;
 	struct tasklet_struct	rxempty_task;
 	struct tasklet_struct	rxclean_task;
 	struct tasklet_struct	txclean_task;