Thread (9 messages) 9 messages, 3 authors, 2023-02-18

Re: [PATCH v1 RFC] video/hdmi: Fix HDMI_VENDOR_INFOFRAME_SIZE

From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Date: 2023-02-11 20:44:08
Also in: dri-devel, lkml

Hello Ville.

On Mon, Feb 6, 2023 at 10:58 AM Ville Syrjälä
[off-list ref] wrote:
[...]
quoted
Change HDMI_VENDOR_INFOFRAME_SIZE to 6 bytes so
hdmi_vendor_infoframe_pack_only() can properly check the passed buffer
size and avoid an out of bounds write to ptr[8] or ptr[9].
The function should return -ENOSPC if the caller didn't
provide a big enough buffer.
Indeed, I'm not sure why I didn't notice when I sent the patch.
Are you saying there are drivers that are passing a bogus size here?
Thankfully not - at least when I checked the last time drivers passed
a 10 byte - or bigger - buffer.
My main concern is the HDMI_INFOFRAME_SIZE macro. It's used in various
drivers like this:
  u8 buffer[HDMI_INFOFRAME_SIZE(AVI)];

One could use HDMI_VENDOR_INFOFRAME_SIZE with this as well:
  u8 buffer[HDMI_INFOFRAME_SIZE(VENDOR)];
But it would only result in an 8 byte wide buffer.
Nobody uses it like this yet.

Do you see any reason why my patch could cause problems?
If not then I want to re-send it with an updated description.


Best regards,
Martin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help