Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1892391pxk; Tue, 1 Sep 2020 10:09:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu6gYdpsEe0MNMERxkmjHJvV0SZh4muVyDR8Y79b5Syas2z5LmrW/4j/TYxvtgHPzY6DQm X-Received: by 2002:a17:906:af53:: with SMTP id ly19mr1779254ejb.503.1598980186455; Tue, 01 Sep 2020 10:09:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598980186; cv=none; d=google.com; s=arc-20160816; b=ePxIt9gfkrOcmSyozgmzbCSggfPLS+WZkwv3qsag/oJvfuPE7yjhwZgVr7Xl78guhA B1FVM9bQOCtMMbhi2m5w8EjJz0Sef3crZVlFnYjYohRQRK67Y5MtUrR/JsH345NGoBzu 7chZkqJkMIj31ODUpqvP1k8Qq5qQDAr2QhhHKwJ3f07Vu2Ju0Y8pz9mAgW5VJORozgUB AN8M7poPlwU9QG3IHqBEZbdhQPGzcY/XrPaEbs5NWIg1LICobjOOBb+OyZatCcGi5wWT H0rXG13x38+Qb07jviZ1Vhp9b4fFGt9Rf3CYuvgsNuKOu567gS2WVSflj0CyYsC7e1tM 9tuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p/PN0pp3Kl+F4pbAh9ZxBchl/7DxY0aQdU5VGSgR00M=; b=vwnus0Gi8oEf1FaxaMkgi3pmhKG2jK2QnCJGd8GKKZIcpugVAggwefZpHaIYD1+MJU 05rLY7auTmTEiHEKb1pevwToFmNrcF2sd4WJPFqWzdgxKR9rCSzqDUUB0ewUoY3XVMEU qzCRp3+oXXUBKnz+zldtruJxXLvz91chVoMORRZawDBKuJlnGt8v6P1HdVte4P4LoRQ/ xhPfPIyBpv7fqUfLC5FuesGbEG0krtc+S7E/p5iwVo4ne0vFyZc49T0dcC2cvLn/TEjC yY+aS6pQ6tmDNSUXulIPA6otBbTgsAjnwXJmpK5ngOkHMHGVvME3g4otkmX384VxW0FB p+TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uShAGOFz; 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 i7si930098edg.600.2020.09.01.10.09.23; Tue, 01 Sep 2020 10:09:46 -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; dkim=pass header.i=@kernel.org header.s=default header.b=uShAGOFz; 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 S1729585AbgIARI2 (ORCPT + 99 others); Tue, 1 Sep 2020 13:08:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:36010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729451AbgIAPSF (ORCPT ); Tue, 1 Sep 2020 11:18:05 -0400 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 BEEE420BED; Tue, 1 Sep 2020 15:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598973485; bh=/Ur067JFdQ/tL9AN3hGu+HrsEjzPVW70BsMe7Owp1xM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uShAGOFzJ4PgB2Ir7jnzE7gMqlU93uuAugnSe5JYTmTNcDwNTG/QPe0HsBG8miso/ c31H/YJkDY8hB0F39/n1lnN3MGIJupCCF7tjmNud6t4/rIy7/OWmYHrwp8KQa+Jsuj n8t2O2/r15nlUOWkJ61WD1VFSkaFI4R3NVjedpUo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , Alex Deucher , Sasha Levin Subject: [PATCH 4.14 18/91] drm/amd/display: fix ref count leak in amdgpu_drm_ioctl Date: Tue, 1 Sep 2020 17:09:52 +0200 Message-Id: <20200901150929.019432148@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150928.096174795@linuxfoundation.org> References: <20200901150928.096174795@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Navid Emamdoost [ Upstream commit 5509ac65f2fe5aa3c0003237ec629ca55024307c ] in amdgpu_drm_ioctl the call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index ae23f7e0290c3..465ece90e63ab 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -801,11 +801,12 @@ long amdgpu_drm_ioctl(struct file *filp, dev = file_priv->minor->dev; ret = pm_runtime_get_sync(dev->dev); if (ret < 0) - return ret; + goto out; ret = drm_ioctl(filp, cmd, arg); pm_runtime_mark_last_busy(dev->dev); +out: pm_runtime_put_autosuspend(dev->dev); return ret; } -- 2.25.1