From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A15CFC433EF for ; Mon, 29 Nov 2021 12:47:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B60F86E98C; Mon, 29 Nov 2021 12:47:00 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C71D6E98C; Mon, 29 Nov 2021 12:46:59 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10182"; a="223184657" X-IronPort-AV: E=Sophos;i="5.87,273,1631602800"; d="scan'208";a="223184657" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2021 04:46:57 -0800 X-IronPort-AV: E=Sophos;i="5.87,273,1631602800"; d="scan'208";a="608691477" Received: from vanderss-mobl.ger.corp.intel.com (HELO [10.249.254.176]) ([10.249.254.176]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2021 04:46:56 -0800 Message-ID: Subject: Re: [PATCH] dma_fence_array: Fix PENDING_ERROR leak in dma_fence_array_signaled() From: Thomas =?ISO-8859-1?Q?Hellstr=F6m?= To: Christian =?ISO-8859-1?Q?K=F6nig?= , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Joonas Lahtinen Date: Mon, 29 Nov 2021 13:46:53 +0100 In-Reply-To: References: <20211129073533.414008-1-thomas.hellstrom@linux.intel.com> <4fd0eee6-342f-fb31-717c-901440f38c35@gmail.com> <58ca11648ab29d96b84640760d2acc3ac2d39d19.camel@linux.intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-2.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linaro-mm-sig@lists.linaro.org, Chris Wilson Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, 2021-11-29 at 13:33 +0100, Christian König wrote: > Am 29.11.21 um 13:23 schrieb Thomas Hellström: > > Hi, Christian, > > > > On Mon, 2021-11-29 at 09:21 +0100, Christian König wrote: > > > Am 29.11.21 um 08:35 schrieb Thomas Hellström: > > > > If a dma_fence_array is reported signaled by a call to > > > > dma_fence_is_signaled(), it may leak the PENDING_ERROR status. > > > > > > > > Fix this by clearing the PENDING_ERROR status if we return true > > > > in > > > > dma_fence_array_signaled(). > > > > > > > > Fixes: 1f70b8b812f3 ("dma-fence: Propagate errors to dma-fence- > > > > array container") > > > > Cc: linaro-mm-sig@lists.linaro.org > > > > Cc: Christian König > > > > Cc: Chris Wilson > > > > Signed-off-by: Thomas Hellström > > > > > > > Reviewed-by: Christian König > > How are the dma-buf / dma-fence patches typically merged? If i915 > > is > > the only fence->error user, could we take this through drm-intel to > > avoid a backmerge for upcoming i915 work? > > Well that one here looks like a bugfix to me, so either through > drm-misc-fixes ore some i915 -fixes branch sounds fine to me. > > If you have any new development based on that a backmerge of the - > fixes > into your -next branch is unavoidable anyway. Ok, I'll check with Joonas if I can take it through drm-intel-gt-next, since fixes are cherry-picked from that one. Patch will then appear in both the -fixes and the -next branch. Thanks, /Thomas > > Regards, > Christian. > > > > > /Thomas > > > > > > > > --- > > > >    drivers/dma-buf/dma-fence-array.c | 6 +++++- > > > >    1 file changed, 5 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma- > > > > buf/dma-fence-array.c > > > > index d3fbd950be94..3e07f961e2f3 100644 > > > > --- a/drivers/dma-buf/dma-fence-array.c > > > > +++ b/drivers/dma-buf/dma-fence-array.c > > > > @@ -104,7 +104,11 @@ static bool > > > > dma_fence_array_signaled(struct > > > > dma_fence *fence) > > > >    { > > > >          struct dma_fence_array *array = > > > > to_dma_fence_array(fence); > > > >    > > > > -       return atomic_read(&array->num_pending) <= 0; > > > > +       if (atomic_read(&array->num_pending) > 0) > > > > +               return false; > > > > + > > > > +       dma_fence_array_clear_pending_error(array); > > > > +       return true; > > > >    } > > > >    > > > >    static void dma_fence_array_release(struct dma_fence *fence) > > >