From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796389225; b=f4jbCDa2uUNXf8Z+lfBAH9ADCReuqBd7MIhPjoV1ZC15mkbAZBGKp9q6pUl0MGykkd1T J9dgdpvo6LBqjuWODfUR1lHheXqf+tD1FFxlNth1ErBsfeJVCiWWQe/jzabC6jP2P3wIZ cbC0LZdeodOGtvYCtKBFE1fj5iHJE3u6le3YWsifQ+AEW4JcEwU9FUVpr4eWkK0Hnm3OT AklKwX9nmlFNjjRePtrBTtWkyv8TsomwD8AIcefMljhFuVMGKTs4J6ONkprBUmvlWGHXo 8aqQ1Mna1+p5rDclQq1tCGCwtbOWYLO35Y8LBctWsCGnIP8X0zLckdr/TbU2MrtI3Dw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389225; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=+xPa90jZb2ZTPtMbTlGstljQT3fSv1Bc5xSOq26emtI=; b=OB7bYCBvhtI1BDk3heffrmKt+mWMqzPGNRYDEZiP3PuCWWq9+m+EijK478PAaW1TnkJa oebNENHeG2jsxllBLHFuE5k3vy+4AP0Kiwb7bEerqm+Q++wItJ5i5Tq+u+R+XrThGVJad W7ysP+kWLHTAkt/UumavqzUpcwVDTo41d0sD9r4rvXOu2JDih6W7YCtCrOWUtqcMHilui /sWIsxPLwIiA+q+DXckNkeALR5tHLo2S//csDnMLy4/0Ry6tCihUNBatpqIlDBljzN3Db uvlR5kkyEAr7MkhJM0C9SmCBftsvTGwUdMJFbPs9fq2Hc5S9Qi37EIV31ZbuJUSEyIA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=QFgjplId; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 735EA606A32C; Fri, 4 Dec 2026 13:00:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=QFgjplId Received: by smtp.kernel.org (Postfix) with ESMTPSA id C01D11F000CE; Fri, 4 Dec 2026 13:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389225; bh=+xPa90jZb2ZTPtMbTlGstljQT3fSv1Bc5xSOq26emtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QFgjplIdvz80HnxJMC8sP5Rv4HK1CtNalmYuSXD2e33KhBaY7w07XOVR/r5Jgvaiz gQPK1vQmVXN76V8pi/MoMMk7M0o2Ef0SUHdnDI7nphSXho6qMyb4BaqaA+DPVYweys b6vPHx4sDjNm5xD+5M1Q+di6cupQpz0Yn16pgDgE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zack Rusin , Aldo Ariel Panzardo Subject: [PATCH 6.1 0912/1059] drm/vmwgfx: return an error when a shared GB surface has no backup buffer Date: Fri, 4 Dec 2026 19:07:23 +0900 Message-ID: <20261204100707.646798846@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aldo Ariel Panzardo commit 3a2f97af36754b64083d463a4cee0af26826bec8 upstream. vmw_gb_surface_reference_internal() rejects a surface that has no backup buffer by logging an error and jumping to out_bad_resource, but it never sets ret on that path. ret is still 0 from the earlier successful vmw_surface_handle_reference(), so the ioctl returns success while leaving the reply structure unfilled — user space is handed a "successful" reply that was never produced. DRM_VMW_GB_SURFACE_REF is DRM_RENDER_ALLOW, so an unprivileged local user can reach it. Set ret to -EINVAL and, on the error paths, drop the reference that vmw_surface_handle_reference() took; once the ioctl fails user space no longer releases it via DRM_VMW_UNREF_SURFACE. The unref is guarded by ret so the shared success fall-through keeps the reference the caller still owns, and it also plugs the same leak on the drm_gem_handle_create() failure path. Fixes: 14b1c33e8429 ("drm/vmwgfx: Add new ioctl for GB surface create and reference") Cc: stable@vger.kernel.org Suggested-by: Zack Rusin Signed-off-by: Aldo Ariel Panzardo Reviewed-by: Zack Rusin [zack: aligned a continuation line with the open parenthesis] Signed-off-by: Zack Rusin Link: https://patch.msgid.link/20261007212051.2574235-2-qwe.aldo@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -1612,6 +1612,7 @@ vmw_gb_surface_reference_internal(struct srf = &user_srf->srf; if (!srf->res.backup) { DRM_ERROR("Shared GB surface is missing a backup buffer.\n"); + ret = -EINVAL; goto out_bad_resource; } metadata = &srf->metadata; @@ -1650,6 +1651,9 @@ vmw_gb_surface_reference_internal(struct rep->creq.must_be_zero = 0; out_bad_resource: + if (ret) + ttm_ref_object_base_unref(vmw_fpriv(file_priv)->tfile, + base->handle); ttm_base_object_unref(&base); return ret;