Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2624453pxj; Mon, 17 May 2021 06:09:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycRzsgQRh2neghM+Z4fsg4ZJXUjm7ZS5e+FQRvP8SMGzZGr7agFvzqq0biU0hcftc3hebz X-Received: by 2002:aa7:d4ca:: with SMTP id t10mr3813665edr.42.1621256944523; Mon, 17 May 2021 06:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621256944; cv=none; d=google.com; s=arc-20160816; b=wDg6p/b1OUXj0mWgN/6HHIHRXiKdpHaUllZE5KDA/egmPxZEKf1qc/c7T8cr4zzNQc 574oCaBDqCjaB9ulcU/LgKDSNmr7+LqXqtLgsbq/kveb/ngjSmcxQw635HMU5YkRPpPz F9YEEALOMsekqgJhklIH+lFpKy8MIcb2NBWot+eBx7Hnz8MmYorpyDFvhLtHKmZzn7Tx dJ2oDREYTHLVI4JbZIOl8F6snv9PEy5G9b/HgZfEISCqXr1iDZyQ1mMekR+pm6LSqnU0 yojYjawJ4ldMw9Dy1l9TAVfY2eq97ELRhKCE8bh5XXE1olB/SCjKutozbWhHOWOvCpHr T0RA== 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 :message-id:date:subject:cc:to:from; bh=xerEk+eb1R4wj39SdtwoEghWt43D8JV0XP8opTiPbvU=; b=qJYS5VlYhIU6LwaNFOLdDojiwflXA2D+owWn96WQTDEkbIY57Ygwk7wTwXRzr3NuYw WBbVWsOSyYsDkZgaNwzgSE/ceNxpGM3h3XNmNQk5rsasxO6XQAP6xZs2cNUQ7xjJNEdN 2P3MI8HZxxDJWRzTXRRDj8y3L0pav87x3IdtnHVUyjcaXdS1H9Kx6v9PFXWQ2aRaoxio enWc7lDplI6lDLJ2Be45tqXEDpuHMB6LjPrhu0S6822d9CwflJkbSe2y9Vul9ipCPmb1 r4j3ioG04nBDdAwwM6g0qD+NM97EY/+OdZoVNVqUAXXOr6WLDChjYIwA139S20i6ETOW 7XBg== ARC-Authentication-Results: i=1; mx.google.com; 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=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l8si7402445edw.40.2021.05.17.06.08.40; Mon, 17 May 2021 06:09:04 -0700 (PDT) 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; 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=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235408AbhEQIKW (ORCPT + 99 others); Mon, 17 May 2021 04:10:22 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:3000 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235219AbhEQIKU (ORCPT ); Mon, 17 May 2021 04:10:20 -0400 Received: from dggems702-chm.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FkBYP2MR3zmWB9; Mon, 17 May 2021 16:06:49 +0800 (CST) Received: from dggema762-chm.china.huawei.com (10.1.198.204) by dggems702-chm.china.huawei.com (10.3.19.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Mon, 17 May 2021 16:09:03 +0800 Received: from huawei.com (10.175.127.227) by dggema762-chm.china.huawei.com (10.1.198.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 17 May 2021 16:09:03 +0800 From: Yu Kuai To: , , , , CC: , , , , Subject: [PATCH] drm/amdgpu: fix PM reference leak in amdgpu_debugfs_gfxoff_rea() Date: Mon, 17 May 2021 16:16:32 +0800 Message-ID: <20210517081632.1563569-1-yukuai3@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggema762-chm.china.huawei.com (10.1.198.204) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced. Reported-by: Hulk Robot Signed-off-by: Yu Kuai --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c index bcaf271b39bf..eb7f9d20dad7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -1058,7 +1058,7 @@ static ssize_t amdgpu_debugfs_gfxoff_read(struct file *f, char __user *buf, if (size & 0x3 || *pos & 0x3) return -EINVAL; - r = pm_runtime_get_sync(adev_to_drm(adev)->dev); + r = pm_runtime_resume_and_get(adev_to_drm(adev)->dev); if (r < 0) return r; -- 2.25.4