Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp655776ybt; Mon, 6 Jul 2020 19:32:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5vLNi+4rstv2DnledVsF2oWYxTzdIsfrj1+avz563qExEhtQNUqoId7+fd6K4oRc5CK5e X-Received: by 2002:a17:907:10d4:: with SMTP id rv20mr31307504ejb.413.1594089143545; Mon, 06 Jul 2020 19:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594089143; cv=none; d=google.com; s=arc-20160816; b=sXFS4OczkwPAvUxpu2LarVFhig9q58PtyHEvE2XuC+q0W74/MHqAg+IU0DX/jkapXn oVwCB96nikEpq0Jzstvuzpv6waws6W1y/TuoE8AW3A0BMwAiWht+j8/ODNsa97nE0XTc cm9eGx8vdbl6Z9CFklcOtR8f+wvmboWfnuaYJa9J4B6FvIN1hGE8HwJF3xt7eNJHioI8 A9vZ3+VoUViyrCwh/2bLGcBKGJbJhhsxVwUuPqUalRB+WGZ6KVg4Oqh78+ywsjyRIReE F5cy7SrEi0/hkXM7wK4DJ+0BtOHjHOS+ecnsQWTAMJaWLoh9nz6YB75LKpsDJeVMzoJO odpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=EA1Qh42QBkvp1HIzeEWb87VWorw5AstArrbMsjfmoUM=; b=Xw6heIWfSO4tlhWXad+5BhkxLMaUINRZcQd+9Xmgp7NEEHHM1U9/M13ItnsxZ9XVhP oXU8y2SFZGTVsuSD3A6noPBEAkG4rlbGHOI4JhTuPx9y6nGPCV+oGV78IPntp0QxpaBD Er9lP5Wg3jgbLrLAoqUo1tVHuzxAtkCU7UMID44QXOfTULPRbwSXCMKHtiDmQzL+NJBy 3sjKfO/msxyfXzYIqGoK2EBmrqKYyPHMjvZyoEDsq18EyB+Jxuds6PWr+LK6tsSYLH46 XsDZzDCYyRfUN70H+zrZ77+28vum8PxOApiLkFcFUvsZ/E065Hm7+3wliss90rkpDAA6 pBVw== 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lg19si13798159ejb.138.2020.07.06.19.31.59; Mon, 06 Jul 2020 19:32:23 -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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727090AbgGGCbg (ORCPT + 99 others); Mon, 6 Jul 2020 22:31:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbgGGCbg (ORCPT ); Mon, 6 Jul 2020 22:31:36 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C19FC061755 for ; Mon, 6 Jul 2020 19:31:36 -0700 (PDT) Received: from kevin (unknown [IPv6:2600:1700:4540:6a60::14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: alyssa) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id A06422A481D; Tue, 7 Jul 2020 03:31:32 +0100 (BST) Date: Mon, 6 Jul 2020 22:31:28 -0400 From: Alyssa Rosenzweig To: Navid Emamdoost Cc: Rob Herring , Tomeu Vizoso , Steven Price , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, emamd001@umn.edu, wu000273@umn.edu, kjlu@umn.edu, smccaman@umn.edu Subject: Re: [PATCH] drm/panfrost: fix ref count leak in panfrost_job_hw_submit Message-ID: <20200707023128.GA16527@kevin> References: <20200614062730.46489-1-navid.emamdoost@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200614062730.46489-1-navid.emamdoost@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Acked-by: Alyssa Rosenzweig On Sun, Jun 14, 2020 at 01:27:30AM -0500, Navid Emamdoost wrote: > in panfrost_job_hw_submit, pm_runtime_get_sync is called which > 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 > --- > drivers/gpu/drm/panfrost/panfrost_job.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c > index 7914b1570841..89ac84667eb1 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_job.c > +++ b/drivers/gpu/drm/panfrost/panfrost_job.c > @@ -147,11 +147,10 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) > > ret = pm_runtime_get_sync(pfdev->dev); > if (ret < 0) > - return; > + goto out; > > if (WARN_ON(job_read(pfdev, JS_COMMAND_NEXT(js)))) { > - pm_runtime_put_sync_autosuspend(pfdev->dev); > - return; > + goto out; > } > > cfg = panfrost_mmu_as_get(pfdev, &job->file_priv->mmu); > @@ -184,6 +183,9 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) > job, js, jc_head); > > job_write(pfdev, JS_COMMAND_NEXT(js), JS_COMMAND_START); > +out: > + pm_runtime_put_sync_autosuspend(pfdev->dev); > + return; > } > > static void panfrost_acquire_object_fences(struct drm_gem_object **bos, > -- > 2.17.1 >