From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@kernel.org
Subject: Re: [PATCH] media: uvcvideo: Fix OOB read
Date: Thu, 20 Jul 2023 09:57:17 +0900 [thread overview]
Message-ID: <20230720005717.GD57770@google.com> (raw)
In-Reply-To: <20230717-uvc-oob-v1-1-f5b9b4aba3b4@chromium.org>
On (23/07/19 12:05), Ricardo Ribalda wrote:
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index 5e9d3da862dd..5e3af66a2223 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -1402,6 +1402,9 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain,
> query_menu->id = id;
> query_menu->index = index;
>
> + if (index >= UVC_MAX_MENU)
> + return -EINVAL;
We probably can just do
if (index >= BITS_PER_TYPE(mapping->menu_mask))
return -EINVAL;
This should be better than using a hard-coded constant or even
BITS_PER_LONG (which is still a hard-coded constant). Because
BITS_PER_LONG won't get us covered if one day ->menu_mask data
type changes.
prev parent reply other threads:[~2023-07-20 0:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-19 12:05 [PATCH] media: uvcvideo: Fix OOB read Ricardo Ribalda
2023-07-20 0:57 ` Sergey Senozhatsky [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=20230720005717.GD57770@google.com \
--to=senozhatsky@chromium.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ribalda@chromium.org \
--cc=stable@kernel.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 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.