summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorZhipeng Lu <alexious@zju.edu.cn>2024-01-18 16:13:00 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-12 11:12:02 +0200
commitcc20c87b04db86c8e3e810bcdca686b406206069 (patch)
tree821b7dc85c96cbcd2131e5e5b5a3d6c668a226ec /drivers/staging
parent1cc6b956ad36cfbaf59ae45615699224d39fbf46 (diff)
downloadlinux-cc20c87b04db86c8e3e810bcdca686b406206069.tar.gz
linux-cc20c87b04db86c8e3e810bcdca686b406206069.tar.bz2
linux-cc20c87b04db86c8e3e810bcdca686b406206069.zip
media: atomisp: ssh_css: Fix a null-pointer dereference in load_video_binaries
[ Upstream commit 3b621e9e9e148c0928ab109ac3d4b81487469acb ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/media/atomisp/pci/sh_css.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c
index 4b3fa6d93fe0..d8a1d4a58db6 100644
--- a/drivers/staging/media/atomisp/pci/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/sh_css.c
@@ -4737,6 +4737,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;
}