On Wed, Oct 23, 2024 at 12:00:48PM +0200, Linus Walleij wrote: > Hi Mukesh, > > On Mon, Oct 14, 2024 at 9:29 PM Mukesh Ojha <quic_mojha@xxxxxxxxxxx> wrote: > > > When two client of the same gpio call pinctrl_select_state() for the > > same functionality, we are seeing NULL pointer issue while accessing > > desc->mux_owner. > > > > Let's say two processes A, B executing in pin_request() for the same pin > > and process A updates the desc->mux_usecount but not yet updated the > > desc->mux_owner while process B see the desc->mux_usecount which got > > updated by A path and further executes strcmp and while accessing > > desc->mux_owner it crashes with NULL pointer. > > > > Serialize the access to mux related setting with a mutex lock. > > > > cpu0 (process A) cpu1(process B) > > > > pinctrl_select_state() { pinctrl_select_state() { > > pin_request() { pin_request() { > > ... > > .... > > } else { > > desc->mux_usecount++; > > desc->mux_usecount && strcmp(desc->mux_owner, owner)) { > > > > if (desc->mux_usecount > 1) > > return 0; > > desc->mux_owner = owner; > > > > } } > > > > Signed-off-by: Mukesh Ojha <quic_mojha@xxxxxxxxxxx> > > Sorry for taking so long! > > I was turning the patch over in my head for the fear that something will > regress but I can only conclude that we need to test this in-tree, so > patch applied so we can get some rotation and boot tests in linux-next! Thanks for queuing. How to check if this has passed the criteria and not regressing anything ? Sorry, I have not subscribed to linux-next mailing list to get regular update. -Mukesh > > Yours, > Linus Walleij