]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: atomisp: ssh_css: Fix a null-pointer dereference in load_video_binaries
authorZhipeng Lu <alexious@zju.edu.cn>
Thu, 18 Jan 2024 15:13:00 +0000 (16:13 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 11 Apr 2024 13:40:28 +0000 (15:40 +0200)
The allocation failure of mycs->yuv_scaler_binary in load_video_binaries()
is followed with a dereference of mycs->yuv_scaler_binary after the
following call chain:

sh_css_pipe_load_binaries()
  |-> load_video_binaries(mycs->yuv_scaler_binary == NULL)
  |
  |-> sh_css_pipe_unload_binaries()
        |-> unload_video_binaries()

In unload_video_binaries(), it calls to ia_css_binary_unload with argument
&pipe->pipe_settings.video.yuv_scaler_binary[i], which refers to the
same memory slot as mycs->yuv_scaler_binary. Thus, a null-pointer
dereference is triggered.

Link: https://lore.kernel.org/r/20240118151303.3828292-1-alexious@zju.edu.cn
Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/sh_css.c

index 938a4ea89c59087f180aed9a8dae7316d61f53b2..8c30191b21a77177820971bddd8eb131539fde20 100644 (file)
@@ -4690,6 +4690,7 @@ static int load_video_binaries(struct ia_css_pipe *pipe)
                                                  sizeof(struct ia_css_binary),
                                                  GFP_KERNEL);
                if (!mycs->yuv_scaler_binary) {
+                       mycs->num_yuv_scaler = 0;
                        err = -ENOMEM;
                        return err;
                }