From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lindgren Subject: Re: [Letux-kernel] BUG: drivers/pinctrl/core: races in pinctrl_groups and deferred probing Date: Mon, 18 Jun 2018 11:17:44 -0700 Message-ID: <20180618181744.GS112168@atomide.com> References: <20180615111318.GJ112168@atomide.com> <029F115C-480E-485A-B547-9D5873925CEF@goldelico.com> <4DE2E482-B0D3-4799-9E2D-74E2180B305B@goldelico.com> <20180618091433.GP112168@atomide.com> <20180618095428.GQ112168@atomide.com> <20180618115122.GT26255@atomide.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: "H. Nikolaus Schaller" Cc: Christ van Willegen , Linus Walleij , Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Andy Shevchenko , kernel@pyra-handheld.com, Discussions about the Letux Kernel List-Id: linux-gpio@vger.kernel.org * H. Nikolaus Schaller [180618 16:46]: > > I can also demonstrate that the duplication has gone: OK good to hear. > And I was no longer able to reproduce the strcmp(NULL) issue. So it is either better hidden > or gone. It should not be possible with checks preventing registering a group or function with no name. I'll try to repost the whole series tomorrow with that added. > So code just needs group cleanup on failed probing and fixing the mutex around pinctrl_generic_add_group(). > > I think we need the mutex because a race still can happen when create_pinctrl() is calling pcs_dt_node_to_map() > and pinctrl_generic_add_group() w/o being locked on pinctrl_maps_mutex. > > The race I suspect is that two drivers are trying to insert the same name and may come > both to the conclusion that it does not yet exist. And both insert into the radix tree. > > The window of risk is small though... It is in pinctrl_generic_add_group() between calling > pinctrl_generic_group_name_to_selector() and radix_tree_insert() so we probably won't > see it in real hardware tests. Hmm but that race should be already fixed with mutex held by the pin controller drivers with these fixes? Or am I missing something still? Regards, Tony