]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: s5p-mfc: fix possible null-pointer dereference in s5p_mfc_probe()
authorTuo Li <islituo@gmail.com>
Thu, 5 Aug 2021 07:55:35 +0000 (09:55 +0200)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:48:15 +0000 (09:48 +0100)
BugLink: https://bugs.launchpad.net/bugs/1951822
[ Upstream commit 8515965e5e33f4feb56134348c95953f3eadfb26 ]

The variable pdev is assigned to dev->plat_dev, and dev->plat_dev is
checked in:
  if (!dev->plat_dev)

This indicates both dev->plat_dev and pdev can be NULL. If so, the
function dev_err() is called to print error information.
  dev_err(&pdev->dev, "No platform data specified\n");

However, &pdev->dev is an illegal address, and it is dereferenced in
dev_err().

To fix this possible null-pointer dereference, replace dev_err() with
mfc_err().

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Tuo Li <islituo@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/media/platform/s5p-mfc/s5p_mfc.c

index eba2b9f040df0b43ff0c4b7d57127c885369a43a..c763c0a03140caa3e22691d7858f0c6e394ed963 100644 (file)
@@ -1283,7 +1283,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
        spin_lock_init(&dev->condlock);
        dev->plat_dev = pdev;
        if (!dev->plat_dev) {
-               dev_err(&pdev->dev, "No platform data specified\n");
+               mfc_err("No platform data specified\n");
                return -ENODEV;
        }