Re: [PATCH] media: uvcvideo: Fix invalid pointer in uvc_ctrl_init_ctrl()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Laurent

Is this needed?

It is already part of v8

https://patchwork.linuxtv.org/project/linux-media/patch/20220617235610.321917-3-ribalda@xxxxxxxxxxxx/

On Mon, 18 Jul 2022 at 14:12, Laurent Pinchart
<laurent.pinchart@xxxxxxxxxxxxxxxx> wrote:
>
> The handling of per-device mappings introduced in commit 86f7ef773156
> ("media: uvcvideo: Add support for per-device control mapping
> overrides") overwrote the mapping variable after it was initialized and
> before it was used, leading to usage of an invalid pointer for devices
> with per-device mappings. Fix it.
>
> Fixes: 86f7ef773156 ("media: uvcvideo: Add support for per-device control mapping overrides")
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> ---
>  drivers/media/usb/uvc/uvc_ctrl.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index e4826a846861..8c208db9600b 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -2413,9 +2413,8 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain,
>  {
>         const struct uvc_control_info *info = uvc_ctrls;
>         const struct uvc_control_info *iend = info + ARRAY_SIZE(uvc_ctrls);
> -       const struct uvc_control_mapping *mapping = uvc_ctrl_mappings;
> -       const struct uvc_control_mapping *mend =
> -               mapping + ARRAY_SIZE(uvc_ctrl_mappings);
> +       const struct uvc_control_mapping *mapping;
> +       const struct uvc_control_mapping *mend;
>
>         /*
>          * XU controls initialization requires querying the device for control
> @@ -2468,6 +2467,9 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain,
>         }
>
>         /* Process common mappings next. */
> +       mapping = uvc_ctrl_mappings;
> +       mend = mapping + ARRAY_SIZE(uvc_ctrl_mappings);
> +
>         for (; mapping < mend; ++mapping) {
>                 if (uvc_entity_match_guid(ctrl->entity, mapping->entity) &&
>                     ctrl->info.selector == mapping->selector)
>
> base-commit: 8bd1dbf8d580c425605fb8936309a4e9745a7a95
> prerequisite-patch-id: 89d2dc61eb83afb89fb075a63e161ea0b87fdcc7
> prerequisite-patch-id: 01354ee4b874fea1acc040a23badff034588362f
> prerequisite-patch-id: 7ae47f109892b89675acbdc0c6bcc1487436ec78
> --
> Regards,
>
> Laurent Pinchart
>


-- 
Ricardo Ribalda



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux