lkml.org 
[lkml]   [2021]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.14 043/138] media: s5p-mfc: fix possible null-pointer dereference in s5p_mfc_probe()
    Date
    From: Tuo Li <islituo@gmail.com>

    [ 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>
    ---
    drivers/media/platform/s5p-mfc/s5p_mfc.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
    index eba2b9f040df0..c763c0a03140c 100644
    --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
    +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
    @@ -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;
    }

    --
    2.33.0
    \
     
     \ /
      Last update: 2021-11-09 02:09    [W:4.700 / U:0.284 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site