]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/connector/hdmi: Fix out of bounds memory read
authorJohn Harrison <John.Harrison@Igalia.com>
Thu, 23 Jul 2026 22:06:52 +0000 (15:06 -0700)
committerMaxime Ripard <mripard@kernel.org>
Mon, 10 Aug 2026 09:38:57 +0000 (11:38 +0200)
A helper function was copying a given audio infoframe into the
connector's copy but using the size of the destination (a generic
target, sized to accept many different data blocks) not the source (a
very specific type of data block). Thus, it was copying 60 bytes of
data from a 28 byte allocation.

Fix that by using the source size instead, together with a build bug
on the source size actually being smaller than the destination.

I hit this running KUnit tests under KASAN (while debugging something
else entirely). In the real world, it seems unlikely to cause an
actual problem. It is a read not a write so it can't corrupt any
memory. However, it could potentially fall off the end of a page and
cause an accvio bug.

Fixes: f378b77227bc ("drm/connector: hdmi: Add Infoframes generation")
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: José Expósito <jose.exposito89@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.org
Cc: stable@vger.kernel.org # v6.11+
Signed-off-by: John Harrison <John.Harrison@Igalia.com>
Link: https://patch.msgid.link/20260723220652.533345-1-John.Harrison@Igalia.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/display/drm_hdmi_state_helper.c

index 4867edbf2622bf7c92c42203280e8e82d8d19656..cae0d85fb44079ce1824311530a4b292c9807dcd 100644 (file)
@@ -1096,7 +1096,8 @@ drm_atomic_helper_connector_hdmi_update_audio_infoframe(struct drm_connector *co
 
        mutex_lock(&connector->hdmi.infoframes.lock);
 
-       memcpy(&infoframe->data, frame, sizeof(infoframe->data));
+       BUILD_BUG_ON(sizeof(*frame) > sizeof(infoframe->data));
+       memcpy(&infoframe->data, frame, sizeof(*frame));
        infoframe->set = true;
 
        ret = write_infoframe(connector, &funcs->audio, "Audio", infoframe);