From: sashiko-bot@kernel.org
To: "Guangshuo Li" <lgs201920130244@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/exynos: vidi: fix EDID leak on concurrent connection ioctl
Date: Wed, 08 Jul 2026 03:40:56 +0000 [thread overview]
Message-ID: <20260708034056.B61C01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708032847.712897-1-lgs201920130244@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Concurrent execution of `vidi_connection_ioctl` and device removal leads to a Use-After-Free of `ctx`.
--
--- Patch [1]: [PATCH] drm/exynos: vidi: fix EDID leak on concurrent connection ioctl ---
commit a672572794a1e16312bff77e391a1da1f3e7e9fe
Author: Guangshuo Li <lgs201920130244@gmail.com>
drm/exynos: vidi: fix EDID leak on concurrent connection ioctl
This commit fixes a memory leak in vidi_connection_ioctl() caused by
concurrent connection requests. It ensures the connection state check
and the EDID assignment are protected by the same critical section to
prevent a second request from overwriting an already allocated EDID.
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> index 67bbf9b8bc0ef..bc0af9e6bc810 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
[ ... ]
> @@ -293,21 +284,37 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
> "edid data is invalid.\n");
> return -EINVAL;
> }
> +
> mutex_lock(&ctx->lock);
[Severity: High]
This is a pre-existing issue, but can this result in a Use-After-Free if
the device is unbound concurrently?
Looking at the start of vidi_connection_ioctl(), ctx is resolved locklessly:
struct device *dev = priv ? priv->vidi_dev : NULL;
struct vidi_context *ctx = dev ? dev_get_drvdata(dev) : NULL;
If an authenticated client calls this ioctl, it can sleep earlier in this
function during copy_from_user() or drm_edid_alloc().
If the exynos-drm-vidi platform device is concurrently unbound via sysfs,
vidi_remove() could complete and devres may free the ctx structure while
the ioctl is sleeping.
Since Exynos DRM uses drm_dev_unregister() instead of drm_dev_unplug()
during teardown, in-flight ioctls are not blocked by the DRM core's
drm_dev_is_unplugged() check.
When the ioctl wakes up and reaches this mutex_lock(&ctx->lock), will it
dereference the freed ctx pointer?
> + if (ctx->connected == vidi->connection) {
> + mutex_unlock(&ctx->lock);
> + drm_edid_free(drm_edid);
> + DRM_DEV_DEBUG_KMS(ctx->dev,
> + "same connection request.\n");
> + return -EINVAL;
> + }
> +
> + drm_edid_free(ctx->raw_edid);
> +
> ctx->raw_edid = drm_edid;
> + ctx->connected = vidi->connection;
> mutex_unlock(&ctx->lock);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260708032847.712897-1-lgs201920130244@gmail.com?part=1
prev parent reply other threads:[~2026-07-08 3:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 3:28 [PATCH] drm/exynos: vidi: fix EDID leak on concurrent connection ioctl Guangshuo Li
2026-07-08 3:40 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260708034056.B61C01F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lgs201920130244@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.