[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200428145257.GA3622@nuc8i5>
Date: Tue, 28 Apr 2020 22:52:57 +0800
From: Dejin Zheng <zhengdejin5@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Nicolas Ferre <nicolas.ferre@...rochip.com>,
"David S. Miller" <davem@...emloft.net>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>, yash.shah@...ive.com,
netdev <netdev@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Claudiu Beznea <Claudiu.Beznea@...rochip.com>
Subject: Re: [PATCH net v1] net: macb: fix an issue about leak related system
resources
On Tue, Apr 28, 2020 at 05:04:32PM +0300, Andy Shevchenko wrote:
> On Tue, Apr 28, 2020 at 4:12 PM Dejin Zheng <zhengdejin5@...il.com> wrote:
> > On Tue, Apr 28, 2020 at 10:42:56AM +0200, Nicolas Ferre wrote:
> > > On 28/04/2020 at 05:24, Dejin Zheng wrote:
> > > > On Mon, Apr 27, 2020 at 01:33:41PM +0300, Andy Shevchenko wrote:
> > > > > On Sat, Apr 25, 2020 at 3:57 PM Dejin Zheng <zhengdejin5@...il.com> wrote:
> > > > > >
> > > > > > A call of the function macb_init() can fail in the function
> > > > > > fu540_c000_init. The related system resources were not released
> > > > > > then. use devm_ioremap() to replace ioremap() for fix it.
> > > > > >
> > > > >
> > > > > Why not to go further and convert to use devm_platform_ioremap_resource()?
> > > > >
> > > > devm_platform_ioremap_resource() will call devm_request_mem_region(),
> > > > and here did not do it.
> > >
> > > And what about devm_platform_get_and_ioremap_resource()? This would
> > > streamline this whole fu540_c000_init() function.
> > >
> > Nicolas, the function devm_platform_get_and_ioremap_resource() will also
> > call devm_request_mem_region(), after call it, These IO addresses will
> > be monopolized by this driver. the devm_ioremap() and ioremap() are not
> > do this. if this IO addresses will be shared with the other driver, call
> > devm_platform_get_and_ioremap_resource() may be fail.
>
> I guess request region is a right thing to do. If driver is sharing
> this IO region with something else, it is a delayed bomb attack and
> has to be fixed.
>
>
I did encounter IO address sharing, for example, some registers are shared
by both PHY and USB controllers on Tegra SoCs. See link[1] for details.
If many people think that devm_request_mem_region() should be added
here, I will send patch v2 and convert to use
devm_platform_ioremap_resource(). Thanks very much!
link[1]: https://patchwork.ozlabs.org/project/linux-tegra/patch/20200127135841.17935-1-zhengdejin5@gmail.com/
BR,
Dejin
>
>
> --
> With Best Regards,
> Andy Shevchenko
Powered by blists - more mailing lists