diff options
| author | Aldo Ariel Panzardo <qwe.aldo@gmail.com> | 2026-10-07 18:20:48 -0300 |
|---|---|---|
| committer | Zack Rusin <zack.rusin@broadcom.com> | 2026-11-16 20:39:47 -0500 |
| commit | 3a2f97af36754b64083d463a4cee0af26826bec8 (patch) | |
| tree | 5e077a5dc74d8aadea9ed3ffb15a707e99b3fa2f /rust/kernel/alloc/kvec/errors.rs | |
| parent | eee4285a8c3c918bbd21791e17f2bb261a709792 (diff) | |
drm/vmwgfx: return an error when a shared GB surface has no backup buffer
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 <zack.rusin@broadcom.com>
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
[zack: aligned a continuation line with the open parenthesis]
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20261007212051.2574235-2-qwe.aldo@gmail.com
Diffstat (limited to 'rust/kernel/alloc/kvec/errors.rs')
0 files changed, 0 insertions, 0 deletions
