Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3870800pxb; Tue, 17 Nov 2020 05:52:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwS9hLjtdwXzX7azxAtmJidIYK3AlqaCRmsn7zThdb1r8qwHbdN1jf7EXQdKLJyplVeP/BJ X-Received: by 2002:a17:907:2063:: with SMTP id qp3mr20100784ejb.314.1605621144744; Tue, 17 Nov 2020 05:52:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605621144; cv=none; d=google.com; s=arc-20160816; b=mmjEXCoP0Og7J/oSKDui/HlwPRSM3anRGH0HW2WSY2QwDfkxWzEpoZW6fEiLT2Q9HW 33WE0QoWSY3WCq7rCaKZtdJqhvWfam2+JMqPsMHxyriHe+toHCP8D4DJBTOksmhOVZcz Rdq7Qjij5CoLSuAAk7f26RgYjVqOqfRKjLaxz2Ya6TJgwspsFnKhO1YK6sGv+WgaBzRO 1XUZL5ja5Sa5NxJM/L5wnkZB/PSQ5U5BrJkgpCAbrjN1JeNq3BgZNOGcYIao+ssEMPIb Qvuv7t7IOuWNgtiRT1Le1dhpqTYqlNvaEiolJDxsHMdpPhNx4NnVpBKKetcE9L+9ure9 ug3g== 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=h4coExTYl7FOwhgCIjR0r05Fa3QiMlHMjEEMg8HdQxM=; b=bpdtD8APqBHS4o8bNZJ9HSQ8eidueg67bcecA8v+qpO7VCwrQksCRwb/zNMHd7EJSh XpBBfvMVeBjJSeoxa29zU43i05LVl0M5LsKVA8Vb7lTHjL5AcxxWUj6qg3l2If3kXWbz BkV+jdDomoHdcoU43ptFI3ErFxIGoV9RU66L7tScLsA9hy4mApMLbx7uRHftepqfT3G+ kxU5Xu/G3lfPL6w6AahoCiI7eXJGokhbeXS6EgZk0Wtm7s+lije8gLMjMwshsRADGERS lqXdpJoPPIY5UfLT4L5C+g1Qfd35PFnQTZMiowRIAgWcHxvc8oUVuQoTn12KMQl7AXAh MWcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CGn+PBFi; 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 bu4si4666953ejb.195.2020.11.17.05.52.01; Tue, 17 Nov 2020 05:52:24 -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=CGn+PBFi; 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 S1732470AbgKQNsQ (ORCPT + 99 others); Tue, 17 Nov 2020 08:48:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:46010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732462AbgKQNfW (ORCPT ); Tue, 17 Nov 2020 08:35:22 -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 B16162467D; Tue, 17 Nov 2020 13:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620122; bh=344KYCt8JlqhsBDq1b3hVsvLmu/FPHqauM+mTbm2F80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CGn+PBFiZ2OXFhNUXg9ncs3ZmN+OuRQ4g6VJR2R7Enh67v8tDC34zKjUSFYdZdvaN CVLsWYXCoRYTmZ7I76XqZBdwgIreFql1gTFED/AT48tymsg3M21dt5pgcD7ue4eNSn wpjxQrs9tv38wRVtH5mpaH73XrHZ67n5p1VFw2vE= 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 5.9 114/255] vfio: platform: fix reference leak in vfio_platform_open Date: Tue, 17 Nov 2020 14:04:14 +0100 Message-Id: <20201117122144.495991275@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@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 c0771a9567fb5..fb4b385191f28 100644 --- a/drivers/vfio/platform/vfio_platform_common.c +++ b/drivers/vfio/platform/vfio_platform_common.c @@ -267,7 +267,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) { @@ -284,7 +284,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