* [PATCH] linux-2.4: vlan: Slab memleak fix
@ 2009-06-29 12:21 Frank Seidel
0 siblings, 0 replies; 2+ messages in thread
From: Frank Seidel @ 2009-06-29 12:21 UTC (permalink / raw)
To: linux-mips@linux-mips.org; +Cc: Seidel, Frank
Author: Arne Redlich <readlicha@sphairon.com>
Fix slab memleak on wan service restart
Signed-off-by: Arne Redlich <redlicha@sphairon.com>
Signed-off-by: Frank Seidel <Frank.Seidel@sphairon.com>
---
net/8021q/vlan_dev.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -548,6 +548,22 @@ int vlan_dev_set_ingress_priority(char *
return -EINVAL;
}
+/* Remove all egress_priority_map hash table entries. --redlicha */
+static void vlan_dev_destroy_egress_priority_map(struct net_device *dev)
+{
+ struct vlan_dev_info *info = VLAN_DEV_INFO(dev);
+ struct vlan_priority_tci_mapping *m;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(info->egress_priority_map); i++) {
+ while ((m = info->egress_priority_map[i])) {
+ info->egress_priority_map[i] =
+ info->egress_priority_map[i]->next;
+ kfree(m);
+ }
+ }
+}
+
int vlan_dev_set_egress_priority(char *dev_name, __u32 skb_prio, short vlan_prio)
{
struct net_device *dev = dev_get_by_name(dev_name);
@@ -826,7 +842,11 @@ void vlan_dev_destruct(struct net_device
if (dev->priv) {
if (VLAN_DEV_INFO(dev)->dent)
BUG();
-
+ /*
+ * Don't leak the hash table entries in
+ * VLAN_DEV_INFO(dev)->egress_priority_map! --redlicha
+ */
+ vlan_dev_destroy_egress_priority_map(dev);
kfree(dev->priv);
dev->priv = NULL;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] linux-2.4: vlan: Slab memleak fix
@ 2009-06-29 15:43 Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2009-06-29 15:43 UTC (permalink / raw)
To: Willy Tarreau; +Cc: Frank Seidel, linux-mips, netdev
From: Arne Redlich <readlicha@sphairon.com>
Fix slab memleak on wan service restart
Signed-off-by: Arne Redlich <redlicha@sphairon.com>
Signed-off-by: Frank Seidel <Frank.Seidel@sphairon.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
net/8021q/vlan_dev.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -548,6 +548,22 @@ int vlan_dev_set_ingress_priority(char *
return -EINVAL;
}
+/* Remove all egress_priority_map hash table entries. --redlicha */
+static void vlan_dev_destroy_egress_priority_map(struct net_device *dev)
+{
+ struct vlan_dev_info *info = VLAN_DEV_INFO(dev);
+ struct vlan_priority_tci_mapping *m;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(info->egress_priority_map); i++) {
+ while ((m = info->egress_priority_map[i])) {
+ info->egress_priority_map[i] =
+ info->egress_priority_map[i]->next;
+ kfree(m);
+ }
+ }
+}
+
int vlan_dev_set_egress_priority(char *dev_name, __u32 skb_prio, short vlan_prio)
{
struct net_device *dev = dev_get_by_name(dev_name);
@@ -826,7 +842,11 @@ void vlan_dev_destruct(struct net_device
if (dev->priv) {
if (VLAN_DEV_INFO(dev)->dent)
BUG();
-
+ /*
+ * Don't leak the hash table entries in
+ * VLAN_DEV_INFO(dev)->egress_priority_map! --redlicha
+ */
+ vlan_dev_destroy_egress_priority_map(dev);
kfree(dev->priv);
dev->priv = NULL;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-29 15:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-29 12:21 [PATCH] linux-2.4: vlan: Slab memleak fix Frank Seidel
-- strict thread matches above, loose matches on Subject: below --
2009-06-29 15:43 Ralf Baechle
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).