From a90ca85b5d765a5f06f60f742732bcc39a6d75c5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 28 Jun 2023 20:29:58 +0200 Subject: [PATCH] 5.10-stable patches added patches: media-atomisp-fix-variable-dereferenced-before-check-asd.patch series --- ...riable-dereferenced-before-check-asd.patch | 63 +++++++++++++++++++ queue-5.10/series | 1 + 2 files changed, 64 insertions(+) create mode 100644 queue-5.10/media-atomisp-fix-variable-dereferenced-before-check-asd.patch create mode 100644 queue-5.10/series diff --git a/queue-5.10/media-atomisp-fix-variable-dereferenced-before-check-asd.patch b/queue-5.10/media-atomisp-fix-variable-dereferenced-before-check-asd.patch new file mode 100644 index 00000000000..48a3017e01b --- /dev/null +++ b/queue-5.10/media-atomisp-fix-variable-dereferenced-before-check-asd.patch @@ -0,0 +1,63 @@ +From ac56760a8bbb4e654b2fd54e5de79dd5d72f937d Mon Sep 17 00:00:00 2001 +From: Tsuchiya Yuto +Date: Wed, 1 Dec 2021 15:19:04 +0100 +Subject: media: atomisp: fix "variable dereferenced before check 'asd'" + +From: Tsuchiya Yuto + +commit ac56760a8bbb4e654b2fd54e5de79dd5d72f937d upstream. + +There are two occurrences where the variable 'asd' is dereferenced +before check. Fix this issue by using the variable after the check. + +Link: https://lore.kernel.org/linux-media/20211122074122.GA6581@kili/ + +Link: https://lore.kernel.org/linux-media/20211201141904.47231-1-kitakar@gmail.com +Reported-by: Dan Carpenter +Signed-off-by: Tsuchiya Yuto +Signed-off-by: Mauro Carvalho Chehab +Igned-off-by: Anastasia Belova +Signed-off-by: Greg Kroah-Hartman +--- + drivers/staging/media/atomisp/pci/atomisp_cmd.c | 3 ++- + drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c ++++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c +@@ -5243,7 +5243,7 @@ static int atomisp_set_fmt_to_isp(struct + int (*configure_pp_input)(struct atomisp_sub_device *asd, + unsigned int width, unsigned int height) = + configure_pp_input_nop; +- u16 stream_index = atomisp_source_pad_to_stream_id(asd, source_pad); ++ u16 stream_index; + const struct atomisp_in_fmt_conv *fc; + int ret, i; + +@@ -5252,6 +5252,7 @@ static int atomisp_set_fmt_to_isp(struct + __func__, vdev->name); + return -EINVAL; + } ++ stream_index = atomisp_source_pad_to_stream_id(asd, source_pad); + + v4l2_fh_init(&fh.vfh, vdev); + +--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c ++++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +@@ -1123,7 +1123,7 @@ int __atomisp_reqbufs(struct file *file, + struct ia_css_frame *frame; + struct videobuf_vmalloc_memory *vm_mem; + u16 source_pad = atomisp_subdev_source_pad(vdev); +- u16 stream_id = atomisp_source_pad_to_stream_id(asd, source_pad); ++ u16 stream_id; + int ret = 0, i = 0; + + if (!asd) { +@@ -1131,6 +1131,7 @@ int __atomisp_reqbufs(struct file *file, + __func__, vdev->name); + return -EINVAL; + } ++ stream_id = atomisp_source_pad_to_stream_id(asd, source_pad); + + if (req->count == 0) { + mutex_lock(&pipe->capq.vb_lock); diff --git a/queue-5.10/series b/queue-5.10/series new file mode 100644 index 00000000000..f1b97e259e1 --- /dev/null +++ b/queue-5.10/series @@ -0,0 +1 @@ +media-atomisp-fix-variable-dereferenced-before-check-asd.patch -- 2.47.3