From patchwork Thu May 3 07:19:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Duyck, Alexander H" X-Patchwork-Id: 156621 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 8A9B3B6FBD for ; Thu, 3 May 2012 17:19:05 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755059Ab2ECHTB (ORCPT ); Thu, 3 May 2012 03:19:01 -0400 Received: from mga01.intel.com ([192.55.52.88]:7905 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755020Ab2ECHTB (ORCPT ); Thu, 3 May 2012 03:19:01 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 03 May 2012 00:19:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="161315313" Received: from gitlad.jf.intel.com ([10.23.23.37]) by fmsmga002.fm.intel.com with ESMTP; 03 May 2012 00:19:00 -0700 Received: from gitlad.jf.intel.com (gitlad.jf.intel.com [127.0.0.1]) by gitlad.jf.intel.com (8.14.2/8.14.2) with ESMTP id q437JEkP013767; Thu, 3 May 2012 00:19:14 -0700 From: Alexander Duyck Subject: [v2 PATCH 4/4] ixgbe: Fix use after free on module remove To: netdev@vger.kernel.org Cc: davem@davemloft.net, jeffrey.t.kirsher@intel.com, edumazet@google.com Date: Thu, 03 May 2012 00:19:14 -0700 Message-ID: <20120503071914.13636.31157.stgit@gitlad.jf.intel.com> In-Reply-To: <20120503071141.13636.37564.stgit@gitlad.jf.intel.com> References: <20120503071141.13636.37564.stgit@gitlad.jf.intel.com> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org While testing the TCP changes I had to fix an issue in order to be able to load and unload the module. The recent patch that added thermal sensor support added a use after free bug on module unload with an 82598 adapter in the system. To resolve the issue I have updated the code so that when we free the info_kobj we set it back to NULL. I suspect there are likely other bugs present, but I will leave that for another patch that can undergo more testing. I am submitting this directly to net-next since this fixes a fairly serious bug that will lock up the ixgbe module until the system is rebooted. Signed-off-by: Alexander Duyck Cc: Jeff Kirsher --- drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) -- 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 --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c index aa41fb7..f81c166 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c @@ -185,8 +185,10 @@ static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter *adapter) hwmon_device_unregister(adapter->ixgbe_hwmon_buff.device); #endif /* CONFIG_IXGBE_HWMON */ - if (adapter->info_kobj != NULL) + if (adapter->info_kobj != NULL) { kobject_put(adapter->info_kobj); + adapter->info_kobj = NULL; + } } /* called from ixgbe_main.c */