lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ9a7Vhh95jMmfKeD40n88GXf3iYC3Hv6y1KJxEYnsKAkem7gQ@mail.gmail.com>
Date:   Fri, 11 Aug 2023 09:48:02 +0100
From:   Mike Leach <mike.leach@...aro.org>
To:     Anshuman Khandual <anshuman.khandual@....com>
Cc:     linux-arm-kernel@...ts.infradead.org, suzuki.poulose@....com,
        James Clark <james.clark@....com>, coresight@...ts.linaro.org,
        linux-kernel@...r.kernel.org,
        Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: [PATCH] coresight: etm4x: Ensure valid drvdata and clock before clk_put()

On Fri, 11 Aug 2023 at 07:27, Anshuman Khandual
<anshuman.khandual@....com> wrote:
>
> This validates 'drvdata' and 'drvdata->pclk' clock before calling clk_put()
> in etm4_remove_platform_dev(). The problem was detected using Smatch static
> checker as reported.
>
> Cc: Suzuki K Poulose <suzuki.poulose@....com>
> Cc: Mike Leach <mike.leach@...aro.org>
> Cc: James Clark <james.clark@....com>
> Cc: coresight@...ts.linaro.org
> Cc: linux-arm-kernel@...ts.infradead.org
> Cc: linux-kernel@...r.kernel.org
> Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> Closes: https://lists.linaro.org/archives/list/coresight@lists.linaro.org/thread/G4N6P4OXELPLLQSNU3GU2MR4LOLRXRMJ/
> Signed-off-by: Anshuman Khandual <anshuman.khandual@....com>
> ---
> This applies on coresight-next
>
>  drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index 703b6fcbb6a5..eb412ce302cc 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -2269,7 +2269,7 @@ static int __exit etm4_remove_platform_dev(struct platform_device *pdev)
>                 etm4_remove_dev(drvdata);
>         pm_runtime_disable(&pdev->dev);
>
> -       if (drvdata->pclk)
> +       if (drvdata && drvdata->pclk && !IS_ERR(drvdata->pclk))
>                 clk_put(drvdata->pclk);
>
>         return 0;
> --
> 2.25.1
>

Reviewed-by: Mike Leach <mike.leach@...ro.org>
-- 
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ