Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5205606A322 for ; Thu, 3 Dec 2026 14:01:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.a=rsa-sha256 header.s=20170329 header.b=qHgi26lE Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B8C6B1128E4; Thu, 3 Dec 2026 14:01:41 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5C2C410E763; Thu, 3 Dec 2026 14:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:From:Reply-To; bh=PJN+eoAPjo109OaLF3ZmWJ97/x+4PyFWlD9Wm9vIGxY=; t=1796306495; x=2111666495; b=qHgi26lE4QaFGYvTdGhqyaSXQH1vwTPWpy4dQzFKT5Hwakf qGjEUUJe+hu5HXmix5smZdetXu9KTaw7Inj9I3yUA7OnZEtACI4ySulShuXLBXDQuVJRGWrgXpuhu Db2p3eZC2FK5EmXvxXx66njUUbwJusz70LpEeZPL6rvVIkp0AQZIvYic35yX9Mg5Hv8BKW9VCccYm lNalHT+nVWdxkePt1m9RsbR/phqueqUSqlEHpmHyPIuaX74wn+7H826ibrQHqfUwTr5TZ6+FAi1d8 4DilDUulFxD3b5NTjayzLvzG0JZD+CGAeBReCX4o6zRK3YHVXMP/8kcZlJN687VQ==; Received: from [81.79.79.1] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) (envelope-from ) id 1xZ7NN-00000001fWg-1z0A; Thu, 03 Dec 2026 15:01:33 +0100 From: Tvrtko Ursulin To: dri-devel@lists.freedesktop.org Cc: kernel-dev@igalia.com, Tvrtko Ursulin , Lucas Stach , Russell King , Christian Gmeiner , etnaviv@lists.freedesktop.org Subject: [PATCH v2 02/10] drm/etnaviv: Release context id on failure Date: Thu, 3 Dec 2026 14:01:20 +0000 Message-ID: <20261203140128.6813-3-tvrtko.ursulin@igalia.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261203140128.6813-1-tvrtko.ursulin@igalia.com> References: <20261203140128.6813-1-tvrtko.ursulin@igalia.com> X-Archived-By: 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-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-17.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Cleanup on the etnaviv_open() failure path looks incomplete in that the context id is left allocated. Fix it by adding proper onion unwind. Signed-off-by: Tvrtko Ursulin Cc: Lucas Stach Cc: Russell King Cc: Christian Gmeiner Cc: etnaviv@lists.freedesktop.org --- Compile tested only. And as I cannot see that these ids are used anywhere I am not marking this as a fix. --- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c index ec1352c1b09f..7bd7aef723c3 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -79,7 +79,7 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file) priv->cmdbuf_suballoc); if (!ctx->mmu) { ret = -ENOMEM; - goto out_free; + goto out_id; } for (i = 0; i < ETNA_MAX_PIPES; i++) { @@ -98,6 +98,8 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file) return 0; +out_id: + xa_erase(&priv->active_contexts, ctx->id); out_free: kfree(ctx); return ret; -- 2.56.0