Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3852126pxb; Tue, 17 Nov 2020 05:24:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5pxffNHwast/94P/Jz4tP117V2Ok4vGy2pu9Xr61o+uUuh2d4Qjup6oUYD11g0KHpDPpg X-Received: by 2002:a17:906:af47:: with SMTP id ly7mr20332568ejb.532.1605619476593; Tue, 17 Nov 2020 05:24:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619476; cv=none; d=google.com; s=arc-20160816; b=Ud94TVeNMQJ8dy49L0jZw/0ogyvaF0SRq2RVi9+k0Det/Wy7P3in6WNc+3a5cVQNhM Ww6ZBtJKJ0dPQ1cBrgkjpPdJ8WTSbyDMtwN+ISUpFbY/RAbvT3aWeo/+3c14pC4sa7Lj RyIdmaalBD3B9v3QTPbxrifyxUT7qcmdrhhbzwgJaJHrLhKLhozosWAayPbHBHifeTDK noavUXhSih6LHUYnbY0aGj68vNLIu3xgN0YwRfj5Co45t4QZPMTKzkNTcabZre+dinMw qrD94rtIz3im0ZHgMCPfkjKdFeqo3hd4kTAM9Fkq6Hk9QH24TXyZl5gbDi7wq2MIgU1a u96Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y7iJkhC7xjh3DHwWPKUAHkqPDHw9g88AXn4Gi3sbsU4=; b=zC/Brq2+xFwY3V5RfxOCnJ96R4P1+zccCcrNiTx3ji74gW5UzWl4mNtsAHPN+8EzoM j1bp4eJyHKmD9GwUUWdoRpvf6CBQnktzBfyrJt9hsvsioIcQqRUpBSxS6A9RPC2aHX8j hrYLx5d0gQdv3koU/qAZvwnV3cUJBUMlupfJ3iLFkiaKsCtFmlbSMrS8TOl20ZQ7UTd0 mUrR1U5dJlOHK2ceR2JhIbWIvLd1M2g3Nv8LvYKoVn7FAN01cccwaoJXESu2bgYu5SJA Fp79S4msDaXSvOkkzdXRhqNJhYgGFJOl/uIcstoLz2UVZ2hiFXafMN90y5+1r9bYdV4s 4qfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q70VLBZL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si10451629eja.279.2020.11.17.05.24.12; Tue, 17 Nov 2020 05:24:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q70VLBZL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730803AbgKQNUw (ORCPT + 99 others); Tue, 17 Nov 2020 08:20:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:54150 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730574AbgKQNUk (ORCPT ); Tue, 17 Nov 2020 08:20:40 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 52D01206D5; Tue, 17 Nov 2020 13:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619240; bh=cpf2rMftQf7xL/9QBBlS7qxPonhitPWGCCg9v88FIY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q70VLBZLu0ea4tkKwVKr20JTVn7ciGfPLpQGXZTM81sVD8ARHXUqg4/Yrwur5MIVJ PujnRJL28SRx78cvmFhCMcGf3101FYTKcwEC5r3v7vAGONd1KngA1rhdu7NKlH/SET 5ug8vy2iDhc8pJyP+pucryRRp5Jh1wTbonWsi9Ew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Eric Auger , Alex Williamson , Sasha Levin Subject: [PATCH 4.19 045/101] vfio: platform: fix reference leak in vfio_platform_open Date: Tue, 17 Nov 2020 14:05:12 +0100 Message-Id: <20201117122115.291403772@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122113.128215851@linuxfoundation.org> References: <20201117122113.128215851@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Qilong [ Upstream commit bb742ad01961a3b9d1f9d19375487b879668b6b2 ] pm_runtime_get_sync() will increment pm usage counter even it failed. Forgetting to call pm_runtime_put will result in reference leak in vfio_platform_open, so we should fix it. Signed-off-by: Zhang Qilong Acked-by: Eric Auger Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin --- drivers/vfio/platform/vfio_platform_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c index c0cd824be2b76..460760d0becfe 100644 --- a/drivers/vfio/platform/vfio_platform_common.c +++ b/drivers/vfio/platform/vfio_platform_common.c @@ -273,7 +273,7 @@ static int vfio_platform_open(void *device_data) ret = pm_runtime_get_sync(vdev->device); if (ret < 0) - goto err_pm; + goto err_rst; ret = vfio_platform_call_reset(vdev, &extra_dbg); if (ret && vdev->reset_required) { @@ -290,7 +290,6 @@ static int vfio_platform_open(void *device_data) err_rst: pm_runtime_put(vdev->device); -err_pm: vfio_platform_irq_cleanup(vdev); err_irq: vfio_platform_regions_cleanup(vdev); -- 2.27.0