[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdaAVE8VMNCFA4jQ1+YLuC9=4mc9Bp2PRxeNFQoHB+NJrA@mail.gmail.com>
Date: Wed, 23 Oct 2024 12:00:48 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Mukesh Ojha <quic_mojha@...cinc.com>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] pinmux: Use sequential access to access desc->pinmux data
Hi Mukesh,
On Mon, Oct 14, 2024 at 9:29 PM Mukesh Ojha <quic_mojha@...cinc.com> 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@...cinc.com>
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!
Yours,
Linus Walleij
Powered by blists - more mailing lists