From patchwork Sun Sep 29 20:41:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salam Noureddine X-Patchwork-Id: 278885 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D18062C00AD for ; Mon, 30 Sep 2013 06:41:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755247Ab3I2Ulv (ORCPT ); Sun, 29 Sep 2013 16:41:51 -0400 Received: from mail-pb0-f43.google.com ([209.85.160.43]:60875 "EHLO mail-pb0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755099Ab3I2Ult (ORCPT ); Sun, 29 Sep 2013 16:41:49 -0400 Received: by mail-pb0-f43.google.com with SMTP id md4so4704214pbc.16 for ; Sun, 29 Sep 2013 13:41:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=4NhvSS7MJnrAAj+2AlubvD7hIDzs+YOkVU/BLKrosOE=; b=KmmEhXjSqI28afTPmAoiuVwp3j8VJv6AfX6THCRkwPRY6wHKfJqyZlnEWvJsO86wR4 ArlM3u3aIrcijTEZCHjqMKYy5yfLhmoTzbsYZsl7KuF+mfEVY13xJ4jU5rXzcIjMZTOC 5wUIxHC6orhmbxuP7j8bRfuVmgWd1r5vmfJI1KCWfw/vLz+R0wX5Kbn/dauaDSYKoOiw xWV9gmpk4dNp1DiEUSyQzYHmNASt6R6SDrvOWd6025mZfomUz8v01f8bEOgdFRarQ5kp WDlOBpn2wTglmfVBer6xpPhv0LOo1YH+S1Vu6VINyV4qtJjGzmdzzwfzSFRkfsjOoXJx bNYA== X-Gm-Message-State: ALoCoQmcOYM497gNPTzDLmV0eEr6iLB3E7K4vMbdmIR7qqJlJenCxXaBj9/OBcspxgVqr2Wo9QX5 X-Received: by 10.68.180.34 with SMTP id dl2mr19718823pbc.6.1380487309026; Sun, 29 Sep 2013 13:41:49 -0700 (PDT) Received: from localhost.localdomain (c-174-62-111-6.hsd1.ca.comcast.net. [174.62.111.6]) by mx.google.com with ESMTPSA id tx5sm22382306pbc.29.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 29 Sep 2013 13:41:48 -0700 (PDT) From: Salam Noureddine To: "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev@vger.kernel.org Cc: Salam Noureddine Subject: [PATCH 2/2] ipv6 mcast: use in6_dev_put in timer handlers instead of __in6_dev_put Date: Sun, 29 Sep 2013 13:41:34 -0700 Message-Id: <1380487294-1676-1-git-send-email-noureddine@aristanetworks.com> X-Mailer: git-send-email 1.7.4.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org It is possible for the timer handlers to run after the call to ipv6_mc_down so use in6_dev_put instead of __in6_dev_put in the handler function in order to do proper cleanup when the refcnt reaches 0. Otherwise, the refcnt can reach zero without the inet6_dev being destroyed and we end up leaking a reference to the net_device and see messages like the following, unregister_netdevice: waiting for eth0 to become free. Usage count = 1 Tested on linux-3.4.43. Signed-off-by: Salam Noureddine --- net/ipv6/mcast.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 096cd67..d18f9f9 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -2034,7 +2034,7 @@ static void mld_dad_timer_expire(unsigned long data) if (idev->mc_dad_count) mld_dad_start_timer(idev, idev->mc_maxdelay); } - __in6_dev_put(idev); + in6_dev_put(idev); } static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode, @@ -2379,7 +2379,7 @@ static void mld_gq_timer_expire(unsigned long data) idev->mc_gq_running = 0; mld_send_report(idev, NULL); - __in6_dev_put(idev); + in6_dev_put(idev); } static void mld_ifc_timer_expire(unsigned long data) @@ -2392,7 +2392,7 @@ static void mld_ifc_timer_expire(unsigned long data) if (idev->mc_ifc_count) mld_ifc_start_timer(idev, idev->mc_maxdelay); } - __in6_dev_put(idev); + in6_dev_put(idev); } static void mld_ifc_event(struct inet6_dev *idev)