From patchwork Wed Sep 12 14:24:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 1444151 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C4546DF28C for ; Wed, 12 Sep 2012 14:25:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759134Ab2ILOYz (ORCPT ); Wed, 12 Sep 2012 10:24:55 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:48249 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759101Ab2ILOYx (ORCPT ); Wed, 12 Sep 2012 10:24:53 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr13so2343679pbb.19 for ; Wed, 12 Sep 2012 07:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=/qKAEZ9Nbg4z9CzSGQjdTrZTu4zQsahvLahKYZnmzLw=; b=MQo7YaPBv1uNUSlVCzjzwZ90dQ8GNPX/1h425/DCZUkmPpCIrpSGmLGT9khMzj2bgm 1DCaUJgQWdJQvEwEriNV4wgoAJ7DvYLcQf10cIZL2giYlno7ulpHkgthgzaLX3PajLwr L0A7Cr9sd+XK8fZlraOTHb0cDmQw2sxSIc/psfmjPInaf8YpyiFTR/fBjbvREy1vAo3o qQj4t2CuGP1+LbgaqehLTq0Gbqgy2SKnNTAj7DdCQQeNIZJY6olFAwyU6XjxiGJ1ZvDy QcGQ/etBNq/RGkCNBPcvXrZ0nXpbQg05ZnwE4TWh5FmoVO2fOU496vYjycwOcnDGdUlh aC4w== Received: by 10.68.236.67 with SMTP id us3mr16957535pbc.80.1347459892886; Wed, 12 Sep 2012 07:24:52 -0700 (PDT) Received: from localhost.localdomain ([221.221.24.96]) by mx.google.com with ESMTPS id uu6sm11464996pbc.70.2012.09.12.07.24.47 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Sep 2012 07:24:52 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas Cc: Jiang Liu , huxinwei@huawei.com, Jiang Liu , linux-pci@vger.kernel.org Subject: [PATCH] eeepc-laptop: fix device reference count leakage in eeepc_rfkill_hotplug() Date: Wed, 12 Sep 2012 22:24:29 +0800 Message-Id: <1347459869-5709-1-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Fix a device reference count leakage issue in function eeepc_rfkill_hotplug(). Reviewed-by: Bjorn Helgaas --- drivers/platform/x86/eeepc-laptop.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index dab91b4..5ca2641 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c @@ -610,12 +610,12 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle) if (!bus) { pr_warn("Unable to find PCI bus 1?\n"); - goto out_unlock; + goto out_put_dev; } if (pci_bus_read_config_dword(bus, 0, PCI_VENDOR_ID, &l)) { pr_err("Unable to read PCI config space?\n"); - goto out_unlock; + goto out_put_dev; } absent = (l == 0xffffffff); @@ -627,7 +627,7 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle) absent ? "absent" : "present"); pr_warn("skipped wireless hotplug as probably " "inappropriate for this model\n"); - goto out_unlock; + goto out_put_dev; } if (!blocked) { @@ -635,7 +635,7 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle) if (dev) { /* Device already present */ pci_dev_put(dev); - goto out_unlock; + goto out_put_dev; } dev = pci_scan_single_device(bus, 0); if (dev) { @@ -650,6 +650,8 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle) pci_dev_put(dev); } } +out_put_dev: + pci_dev_put(port); } out_unlock: