public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	bleung@chromium.org, groeck@chromium.org,
	ajye_huang@compal.corp-partner.google.com,
	hellojacky0226@hotmail.com, zhuohao@chromium.org,
	scott_chao@wistron.corp-partner.google.com,
	linux-media@vger.kernel.org, chrome-platform@lists.linux.dev
Subject: [PATCH AUTOSEL 5.10 04/14] media: cros-ec-cec: limit msg.len to CEC_MAX_MSG_SIZE
Date: Tue,  1 Nov 2022 07:30:00 -0400	[thread overview]
Message-ID: <20221101113012.800271-4-sashal@kernel.org> (raw)
In-Reply-To: <20221101113012.800271-1-sashal@kernel.org>

From: Hans Verkuil <hverkuil-cisco@xs4all.nl>

[ Upstream commit 2dc73b48665411a08c4e5f0f823dea8510761603 ]

I expect that the hardware will have limited this to 16, but just in
case it hasn't, check for this corner case.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
index 2d95e16cd248..f66699d5dc66 100644
--- a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
+++ b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
@@ -44,6 +44,8 @@ static void handle_cec_message(struct cros_ec_cec *cros_ec_cec)
 	uint8_t *cec_message = cros_ec->event_data.data.cec_message;
 	unsigned int len = cros_ec->event_size;
 
+	if (len > CEC_MAX_MSG_SIZE)
+		len = CEC_MAX_MSG_SIZE;
 	cros_ec_cec->rx_msg.len = len;
 	memcpy(cros_ec_cec->rx_msg.msg, cec_message, len);
 
-- 
2.35.1


  parent reply	other threads:[~2022-11-01 11:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-01 11:29 [PATCH AUTOSEL 5.10 01/14] media: rkisp1: Initialize color space on resizer sink and source pads Sasha Levin
2022-11-01 11:29 ` [PATCH AUTOSEL 5.10 02/14] media: rkisp1: Zero v4l2_subdev_format fields in when validating links Sasha Levin
2022-11-01 11:29 ` [PATCH AUTOSEL 5.10 03/14] media: s5p_cec: limit msg.len to CEC_MAX_MSG_SIZE Sasha Levin
2022-11-01 11:30 ` Sasha Levin [this message]
2022-11-01 11:30 ` [PATCH AUTOSEL 5.10 05/14] media: dvb-frontends/drxk: initialize err to 0 Sasha Levin
2022-11-01 11:30 ` [PATCH AUTOSEL 5.10 06/14] media: meson: vdec: fix possible refcount leak in vdec_probe() Sasha Levin
2022-11-01 11:30 ` [PATCH AUTOSEL 5.10 07/14] media: atomisp: Ensure that USERPTR pointers are page aligned Sasha Levin
2022-11-01 11:30 ` [PATCH AUTOSEL 5.10 08/14] media: atomisp: Fix v4l2_fh resource leak on open errors Sasha Levin
2022-11-01 11:30 ` [PATCH AUTOSEL 5.10 09/14] ACPI: APEI: Fix integer overflow in ghes_estatus_pool_init() Sasha Levin
2022-11-01 11:30 ` [PATCH AUTOSEL 5.10 10/14] hwrng: bcm2835 - use hwrng_msleep() instead of cpu_relax() Sasha Levin
2022-11-01 11:30 ` [PATCH AUTOSEL 5.10 11/14] scsi: core: Restrict legal sdev_state transitions via sysfs Sasha Levin
2022-11-01 11:30 ` [PATCH AUTOSEL 5.10 12/14] HID: saitek: add madcatz variant of MMO7 mouse device ID Sasha Levin
2022-11-01 11:30 ` [PATCH AUTOSEL 5.10 13/14] drm/amdgpu: set vm_update_mode=0 as default for Sienna Cichlid in SRIOV case Sasha Levin
2022-11-01 11:30 ` [PATCH AUTOSEL 5.10 14/14] i2c: xiic: Add platform module alias Sasha Levin

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=20221101113012.800271-4-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=ajye_huang@compal.corp-partner.google.com \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=groeck@chromium.org \
    --cc=hellojacky0226@hotmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=scott_chao@wistron.corp-partner.google.com \
    --cc=stable@vger.kernel.org \
    --cc=zhuohao@chromium.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox