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]
Date:   Wed, 21 Sep 2022 10:35:42 +0100
From:   Robin Murphy <robin.murphy@....com>
To:     Dario Binacchi <dario.binacchi@...rulasolutions.com>,
        linux-kernel@...r.kernel.org
Cc:     linux-amarula@...rulasolutions.com,
        Michael Trimarchi <michael@...rulasolutions.com>,
        stable@...r.kernel.org, Fabio Estevam <festevam@...il.com>,
        NXP Linux Team <linux-imx@....com>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Shawn Guo <shawnguo@...nel.org>, Vinod Koul <vkoul@...nel.org>,
        dmaengine@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [RESEND PATCH v5 2/2] dmaengine: mxs: fix section mismatch

On 2022-09-04 15:10, Dario Binacchi wrote:
> The patch was suggested by the following modpost warning:
> 
> WARNING: modpost: vmlinux.o(.data+0xa3900): Section mismatch in reference from the variable mxs_dma_driver to the function .init.text:mxs_dma_probe()
> The variable mxs_dma_driver references
> the function __init mxs_dma_probe()
> If the reference is valid then annotate the
> variable with __init* or __refdata (see linux/init.h) or name the variable:
> *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

This is very wrong - even *with* platform_driver_probe(), the driver may 
remain registered beyond init, so when the driver core walks the list 
trying to match a driver for some other device later it can access freed 
data and crash. Which is absolutely no fun to debug...

The correct fix is to remove the __init annotation from the probe 
routine. If you want to support deferred probe, consider that even your 
own probe call might potentially be delayed until after initdata is freed.

Thanks,
Robin.

> Co-developed-by: Michael Trimarchi <michael@...rulasolutions.com>
> Signed-off-by: Michael Trimarchi <michael@...rulasolutions.com>
> Signed-off-by: Dario Binacchi <dario.binacchi@...rulasolutions.com>
> Cc: stable@...r.kernel.org
> ---
> 
> (no changes since v1)
> 
>   drivers/dma/mxs-dma.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index 18f8154b859b..a01953e06048 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -834,7 +834,7 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
>   	return 0;
>   }
>   
> -static struct platform_driver mxs_dma_driver = {
> +static struct platform_driver mxs_dma_driver __initdata = {
>   	.driver		= {
>   		.name	= "mxs-dma",
>   		.of_match_table = mxs_dma_dt_ids,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ