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.4 26/74] media: s5p-mfc: Add checking to s5p_mfc_probe().
    Date
    From: Nadezda Lutovinova <lutovinova@ispras.ru>

    [ Upstream commit cdfaf4752e6915a4b455ad4400133e540e4dc965 ]

    If of_device_get_match_data() return NULL,
    then null pointer dereference occurs in s5p_mfc_init_pm().
    The patch adds checking if dev->variant is NULL.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Nadezda Lutovinova <lutovinova@ispras.ru>
    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 | 4 ++++
    1 file changed, 4 insertions(+)

    diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
    index f8a5ed6bb9d7a..9faecd049002f 100644
    --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
    +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
    @@ -1284,6 +1284,10 @@ static int s5p_mfc_probe(struct platform_device *pdev)
    }

    dev->variant = of_device_get_match_data(&pdev->dev);
    + if (!dev->variant) {
    + dev_err(&pdev->dev, "Failed to get device MFC hardware variant information\n");
    + return -ENOENT;
    + }

    res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
    dev->regs_base = devm_ioremap_resource(&pdev->dev, res);
    --
    2.33.0
    \
     
     \ /
      Last update: 2021-11-09 02:40    [W:2.161 / U:1.176 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site