Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5070983rwb; Wed, 21 Sep 2022 02:47:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4j2+TMtMoJFOIuwpeqtCOMiMcZQ6ZncjlpKL9OTgRiu63d6pbA3pWEEsW6kPdbO9BHxT32 X-Received: by 2002:aa7:888f:0:b0:544:7429:b07c with SMTP id z15-20020aa7888f000000b005447429b07cmr28144233pfe.15.1663753633033; Wed, 21 Sep 2022 02:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663753633; cv=none; d=google.com; s=arc-20160816; b=MW5hLvIgMu/uV8MrjfcLpz4te1KGN3IxCrwcXflLkU2idSLsQeNz9JeCSqjqH3ru65 onPHctkX59gwDxO53d1lVCHMf/4J/s6FFQ6lDPRBBvg9vB0jUm+TknfnFPnX81cX04LH HLkoJ2tcwhZhI+ec6Q1p1lt9XFarZYJPe8Mms7jDV45oZzUMqrSToVyc7rjDCYEmc2uV JDMcwPjT40JFVQLvpAUHNWEvg6iKmI4OEU9Noq6yOGrH19DjtHbCIW9Erum5a1ZYTa4w 9DJZBOimhVRzqQA6M1rB5n+ucVRT1gjIMGLtOa+U9BBccJ8COn34hZmYXfrUhpxcv/Nc K4Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=tnECpn4a34azDmQwrf3xTivwSe6RmtHoX2V99Wt6ZvY=; b=O6AP5pLcESVWCRwv4GIW4qtUgJUPpGMT2GGQ0e72x4jcyfNozOHIdNkFGA0ay5Egdt rmv3h3HAWBNn4hnoX7qesVuSijFFRxZTRi7G/IiuHQTKACIcGG2l45ugQBkiOdrLKDns KzaEvjLUueu6NTmBzCeYXCyS9zBuZGcV6HxMbOYTtfn/VM6HoaSaqy041b3im68BV0TS 8JKMdr/ZrfRovS+fQxXDCHdowiTzDoApKMlwJWnhZ8w3eybkztf3b/77Ejf6KDo18/HI Kms0mMm9NbjG0Fq35xRgE+xSd7pNR7Zeg6Gz47crIqjqKUeAk856QhTS20BddqJ5hZEv 5PGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rt15-20020a17090b508f00b0020319d3bb7bsi2203770pjb.18.2022.09.21.02.47.01; Wed, 21 Sep 2022 02:47:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231172AbiIUJft (ORCPT + 99 others); Wed, 21 Sep 2022 05:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbiIUJfr (ORCPT ); Wed, 21 Sep 2022 05:35:47 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3985582D04; Wed, 21 Sep 2022 02:35:46 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 79DE3139F; Wed, 21 Sep 2022 02:35:52 -0700 (PDT) Received: from [10.57.18.118] (unknown [10.57.18.118]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A0C373F73D; Wed, 21 Sep 2022 02:35:43 -0700 (PDT) Message-ID: <2ce32413-d338-5032-71f1-7da183b2c561@arm.com> Date: Wed, 21 Sep 2022 10:35:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [RESEND PATCH v5 2/2] dmaengine: mxs: fix section mismatch Content-Language: en-GB To: Dario Binacchi , linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Michael Trimarchi , stable@vger.kernel.org, Fabio Estevam , NXP Linux Team , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , Vinod Koul , dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20220904141020.2947725-1-dario.binacchi@amarulasolutions.com> <20220904141020.2947725-2-dario.binacchi@amarulasolutions.com> From: Robin Murphy In-Reply-To: <20220904141020.2947725-2-dario.binacchi@amarulasolutions.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Michael Trimarchi > Signed-off-by: Dario Binacchi > Cc: stable@vger.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,