From patchwork Mon Jun 29 15:43:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Baechle X-Patchwork-Id: 29291 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 303B1B70E1 for ; Tue, 30 Jun 2009 01:43:55 +1000 (EST) Received: by ozlabs.org (Postfix) id 23703DDD1C; Tue, 30 Jun 2009 01:43:55 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 9FC54DDD1B for ; Tue, 30 Jun 2009 01:43:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754335AbZF2Pno (ORCPT ); Mon, 29 Jun 2009 11:43:44 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752775AbZF2Pno (ORCPT ); Mon, 29 Jun 2009 11:43:44 -0400 Received: from h5.dl5rb.org.uk ([81.2.74.5]:42981 "EHLO h5.dl5rb.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751999AbZF2Pnn (ORCPT ); Mon, 29 Jun 2009 11:43:43 -0400 Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1]) by h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id n5TFhRYN018885; Mon, 29 Jun 2009 16:43:27 +0100 Received: (from ralf@localhost) by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id n5TFhRr3018883; Mon, 29 Jun 2009 16:43:27 +0100 Date: Mon, 29 Jun 2009 16:43:27 +0100 From: Ralf Baechle To: Willy Tarreau Cc: Frank Seidel , linux-mips@linux-mips.org, netdev@vger.kernel.org Subject: [PATCH] linux-2.4: vlan: Slab memleak fix Message-ID: <20090629154325.GB18570@linux-mips.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arne Redlich Fix slab memleak on wan service restart Signed-off-by: Arne Redlich Signed-off-by: Frank Seidel Signed-off-by: Ralf Baechle --- net/8021q/vlan_dev.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) -- 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 --- 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; }