* [PATCH net-2.6 1/3] jme: Fix VLAN memory leak
@ 2010-03-15 5:15 cooldavid
2010-03-15 5:15 ` [PATCH net-2.6 2/3] jme: Adding lock to protect vlgrp structure cooldavid
0 siblings, 1 reply; 8+ messages in thread
From: cooldavid @ 2010-03-15 5:15 UTC (permalink / raw)
To: David Miller; +Cc: Guo-Fu Tseng, linux-netdev, Ethan Hsiao
From: Guo-Fu Tseng <cooldavid@cooldavid.org>
Fix memory leak while receiving 8021q tagged packet which is not
registered by user.
Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org>
---
drivers/net/jme.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 0f31497..cfc7b98 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -946,6 +946,8 @@ jme_alloc_and_feed_skb(struct jme_adapter *jme, int idx)
jme->jme_vlan_rx(skb, jme->vlgrp,
le16_to_cpu(rxdesc->descwb.vlan));
NET_STAT(jme).rx_bytes += 4;
+ } else {
+ dev_kfree_skb(skb);
}
} else {
jme->jme_rx(skb);
--
1.6.4.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-2.6 2/3] jme: Adding lock to protect vlgrp structure.
2010-03-15 5:15 [PATCH net-2.6 1/3] jme: Fix VLAN memory leak cooldavid
@ 2010-03-15 5:15 ` cooldavid
2010-03-15 5:15 ` [PATCH net-2.6 3/3] jme: Advance driver version number cooldavid
2010-03-15 22:54 ` [PATCH net-2.6 2/3] jme: Adding lock to protect vlgrp structure David Miller
0 siblings, 2 replies; 8+ messages in thread
From: cooldavid @ 2010-03-15 5:15 UTC (permalink / raw)
To: David Miller; +Cc: Guo-Fu Tseng, linux-netdev, Ethan Hsiao
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(-)
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;
--
1.6.4.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-2.6 3/3] jme: Advance driver version number
2010-03-15 5:15 ` [PATCH net-2.6 2/3] jme: Adding lock to protect vlgrp structure cooldavid
@ 2010-03-15 5:15 ` cooldavid
2010-03-15 22:54 ` [PATCH net-2.6 2/3] jme: Adding lock to protect vlgrp structure David Miller
1 sibling, 0 replies; 8+ messages in thread
From: cooldavid @ 2010-03-15 5:15 UTC (permalink / raw)
To: David Miller; +Cc: Guo-Fu Tseng, linux-netdev, Ethan Hsiao
From: Guo-Fu Tseng <cooldavid@cooldavid.org>
Advance driver version number after some bug fix.
Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org>
---
drivers/net/jme.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/jme.h b/drivers/net/jme.h
index 0ed4924..727a3bf 100644
--- a/drivers/net/jme.h
+++ b/drivers/net/jme.h
@@ -25,7 +25,7 @@
#define __JME_H_INCLUDED__
#define DRV_NAME "jme"
-#define DRV_VERSION "1.0.5"
+#define DRV_VERSION "1.0.6"
#define PFX DRV_NAME ": "
#define PCI_DEVICE_ID_JMICRON_JMC250 0x0250
--
1.6.4.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-2.6 2/3] jme: Adding lock to protect vlgrp structure.
2010-03-15 5:15 ` [PATCH net-2.6 2/3] jme: Adding lock to protect vlgrp structure cooldavid
2010-03-15 5:15 ` [PATCH net-2.6 3/3] jme: Advance driver version number cooldavid
@ 2010-03-15 22:54 ` David Miller
2010-03-16 7:49 ` Guo-Fu Tseng
1 sibling, 1 reply; 8+ messages in thread
From: David Miller @ 2010-03-15 22:54 UTC (permalink / raw)
To: cooldavid; +Cc: netdev, ethanhsiao
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-2.6 2/3] jme: Adding lock to protect vlgrp structure.
2010-03-15 22:54 ` [PATCH net-2.6 2/3] jme: Adding lock to protect vlgrp structure David Miller
@ 2010-03-16 7:49 ` Guo-Fu Tseng
2010-03-16 7:55 ` David Miller
0 siblings, 1 reply; 8+ messages in thread
From: Guo-Fu Tseng @ 2010-03-16 7:49 UTC (permalink / raw)
To: David Miller; +Cc: netdev, ethanhsiao
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-2.6 1/3] jme: Fix VLAN memory leak
@ 2010-03-17 10:09 cooldavid
2010-03-17 10:09 ` [PATCH net-2.6 2/3] jme: Protect vlgrp structure by pause RX actions cooldavid
0 siblings, 1 reply; 8+ messages in thread
From: cooldavid @ 2010-03-17 10:09 UTC (permalink / raw)
To: David Miller
Cc: Guo-Fu Tseng, linux-netdev, Ethan Hsiao, Devinchiu, Hsiu-Che Chao,
stable
From: Guo-Fu Tseng <cooldavid@cooldavid.org>
Fix memory leak while receiving 8021q tagged packet which is not
registered by user.
Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org>
Cc: stable@kernel.org
---
drivers/net/jme.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 0f31497..cfc7b98 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -946,6 +946,8 @@ jme_alloc_and_feed_skb(struct jme_adapter *jme, int idx)
jme->jme_vlan_rx(skb, jme->vlgrp,
le16_to_cpu(rxdesc->descwb.vlan));
NET_STAT(jme).rx_bytes += 4;
+ } else {
+ dev_kfree_skb(skb);
}
} else {
jme->jme_rx(skb);
--
1.6.4.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-2.6 2/3] jme: Protect vlgrp structure by pause RX actions.
2010-03-17 10:09 [PATCH net-2.6 1/3] jme: Fix VLAN memory leak cooldavid
@ 2010-03-17 10:09 ` cooldavid
2010-03-17 10:09 ` [PATCH net-2.6 3/3] jme: Advance driver version number cooldavid
0 siblings, 1 reply; 8+ messages in thread
From: cooldavid @ 2010-03-17 10:09 UTC (permalink / raw)
To: David Miller
Cc: Guo-Fu Tseng, linux-netdev, Ethan Hsiao, Devinchiu, Hsiu-Che Chao,
stable
From: Guo-Fu Tseng <cooldavid@cooldavid.org>
Temporary stop the RX IRQ, and disable (sync) tasklet or napi.
And restore it after finished the vlgrp pointer assignment.
Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org>
Cc: stable@kernel.org
---
drivers/net/jme.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index cfc7b98..c0b59a5 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -2083,12 +2083,45 @@ jme_tx_timeout(struct net_device *netdev)
jme_reset_link(jme);
}
+static inline void jme_pause_rx(struct jme_adapter *jme)
+{
+ atomic_dec(&jme->link_changing);
+
+ jme_set_rx_pcc(jme, PCC_OFF);
+ if (test_bit(JME_FLAG_POLL, &jme->flags)) {
+ JME_NAPI_DISABLE(jme);
+ } else {
+ tasklet_disable(&jme->rxclean_task);
+ tasklet_disable(&jme->rxempty_task);
+ }
+}
+
+static inline void jme_resume_rx(struct jme_adapter *jme)
+{
+ struct dynpcc_info *dpi = &(jme->dpi);
+
+ if (test_bit(JME_FLAG_POLL, &jme->flags)) {
+ JME_NAPI_ENABLE(jme);
+ } else {
+ tasklet_hi_enable(&jme->rxclean_task);
+ tasklet_hi_enable(&jme->rxempty_task);
+ }
+ dpi->cur = PCC_P1;
+ dpi->attempt = PCC_P1;
+ dpi->cnt = 0;
+ jme_set_rx_pcc(jme, PCC_P1);
+
+ atomic_inc(&jme->link_changing);
+}
+
static void
jme_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
{
struct jme_adapter *jme = netdev_priv(netdev);
+ jme_pause_rx(jme);
jme->vlgrp = grp;
+ jme_resume_rx(jme);
}
static void
--
1.6.4.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-03-19 4:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-15 5:15 [PATCH net-2.6 1/3] jme: Fix VLAN memory leak cooldavid
2010-03-15 5:15 ` [PATCH net-2.6 2/3] jme: Adding lock to protect vlgrp structure cooldavid
2010-03-15 5:15 ` [PATCH net-2.6 3/3] jme: Advance driver version number cooldavid
2010-03-15 22:54 ` [PATCH net-2.6 2/3] jme: Adding lock to protect vlgrp structure David Miller
2010-03-16 7:49 ` Guo-Fu Tseng
2010-03-16 7:55 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2010-03-17 10:09 [PATCH net-2.6 1/3] jme: Fix VLAN memory leak cooldavid
2010-03-17 10:09 ` [PATCH net-2.6 2/3] jme: Protect vlgrp structure by pause RX actions cooldavid
2010-03-17 10:09 ` [PATCH net-2.6 3/3] jme: Advance driver version number cooldavid
2010-03-19 4:14 ` David Miller
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).