From patchwork Thu May 30 04:31:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 2633621 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 206533FD2B for ; Thu, 30 May 2013 04:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750765Ab3E3Ebp (ORCPT ); Thu, 30 May 2013 00:31:45 -0400 Received: from mail-pb0-f50.google.com ([209.85.160.50]:37449 "EHLO mail-pb0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750717Ab3E3Ebo (ORCPT ); Thu, 30 May 2013 00:31:44 -0400 Received: by mail-pb0-f50.google.com with SMTP id wy17so10354262pbc.37 for ; Wed, 29 May 2013 21:31:44 -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=WIBNl6/YbV32h0GF5SbzATAM1dTrT0Hom8Y/Ia8DTSY=; b=RREaLGblDI3Dm+S05SIfZ3V2rRjGWzVy33v/V/6iPHUK3JZFKT2MLmAjaXF6yd7gNB QjfQEclHxCDiAVhDjy93rGgKmviiLkEKI2j8BAlvI1zf95Lnah/pJEZrL4Lgd7zGTnNn WeQCWn3ci1zHhw7s3NlGHe23oCPGNoAXIx7Yel23APJQZPEJ1YSNKONpFlRfcl6ocTBO vkjw+LwZQ9W0crcwj9NYL1WuzcxwAi1QXF50avnEp1dfPkIWZpF+xArnn2uWHGQjhqW6 N9+6PJ/zPEGyXbFtttUzoXBqoHt4dr/WSSffiBj62eni5q8JJggAySYAys3dwcymjRgq 0CZg== X-Received: by 10.68.239.228 with SMTP id vv4mr6054393pbc.5.1369888304151; Wed, 29 May 2013 21:31:44 -0700 (PDT) Received: from localhost.localdomain (p2155-ipngn4501marunouchi.tokyo.ocn.ne.jp. [153.135.240.155]) by mx.google.com with ESMTPSA id ri8sm40100600pbc.3.2013.05.29.21.31.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 May 2013 21:31:43 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , Yinghai Lu Cc: Jiang Liu , linux-pci@vger.kernel.org Subject: [PATCH] PCI, IOV: fix a resource leakage on error recovery path Date: Thu, 30 May 2013 12:31:33 +0800 Message-Id: <1369888293-13387-1-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1369489718-25869-10-git-send-email-jiang.liu@huawei.com> References: <1369489718-25869-10-git-send-email-jiang.liu@huawei.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Signed-off-by: Jiang Liu --- Hi Bjorn, Could you please help to apply this small patch onto the jiang-bus-lock-v3, which addresses a memory leakage issue pointed out by Yinghai? Or you may fold it into " PCI, IOV: simplify IOV implementation". Thanks! Gerry --- drivers/pci/iov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index 5eb8165..458fb39 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -122,8 +122,9 @@ failed1: pci_dev_put(dev); mutex_lock(&iov->dev->sriov->lock); pci_stop_and_remove_bus_device(virtfn); - virtfn_remove_bus(dev->bus, bus); failed0: + if (bus) + virtfn_remove_bus(dev->bus, bus); mutex_unlock(&iov->dev->sriov->lock); return rc;