linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
	linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org,
	stable@kernel.org
Subject: Re: [PATCH v3 2/3] pinctrl: renesas: rzv2m: Fix NULL pointer dereference in rzv2m_dt_subnode_to_map()
Date: Thu, 17 Aug 2023 14:45:45 +0200	[thread overview]
Message-ID: <CAMuHMdWsUL5Om=+tPxktm8+=P0UmUzXXHOMTzaJxaCTY16G2=w@mail.gmail.com> (raw)
In-Reply-To: <20230815131558.33787-3-biju.das.jz@bp.renesas.com>

Hi Biju,

On Tue, Aug 15, 2023 at 3:16 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Fix the below random NULL pointer crash during boot by serializing
> groups and functions creation in rzv2m_dt_subnode_to_map() with
> mutex lock.
>
> Crash logs:
>  pc : __pi_strcmp+0x20/0x140
>  lr : pinmux_func_name_to_selector+0x68/0xa4
>  Call trace:
>  __pi_strcmp+0x20/0x140
>  pinmux_generic_add_function+0x34/0xcc
>  rzv2m_dt_subnode_to_map+0x2e4/0x418
>  rzv2m_dt_node_to_map+0x15c/0x18c
>  pinctrl_dt_to_map+0x218/0x37c
>  create_pinctrl+0x70/0x3d8
>
> While at it, add comment for lock.
>
> Fixes: 92a9b8252576 ("pinctrl: renesas: Add RZ/V2M pin and gpio controller driver")
> Cc: stable@kernel.org
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v2->v3:
>  * Added comment for lock.
>  * Moved map allocation down to reduce lock section.
>  * Added locks for maps and pinctrl group and function creation/remove
>    calls
>  * Added unlock_and_done label for lock error path.

Thanks for the update!

Upon closer look, I noticed that I had missed that the map allocation
is not global, but local to a specific DT node, so it does not
need protection by a lock.  If no one objects, I will back out that
change myself, queue this patch in renesas-pinctrl-for-v6.6, and send
a PR tomorrow.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2023-08-17 12:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 13:15 [PATCH v3 0/3] Fix NULL pointer dereference in RZ/{G2L,V2M,A2} pinctrl driver Biju Das
2023-08-15 13:15 ` [PATCH v3 1/3] pinctrl: renesas: rzg2l: Fix NULL pointer dereference in rzg2l_dt_subnode_to_map() Biju Das
2023-08-17 12:44   ` Geert Uytterhoeven
2023-08-17 12:46     ` Geert Uytterhoeven
2023-08-17 13:38     ` Linus Walleij
2023-08-17 13:54       ` Geert Uytterhoeven
2023-08-17 15:57         ` Geert Uytterhoeven
2023-08-18  7:23           ` Linus Walleij
2023-08-15 13:15 ` [PATCH v3 2/3] pinctrl: renesas: rzv2m: Fix NULL pointer dereference in rzv2m_dt_subnode_to_map() Biju Das
2023-08-17 12:45   ` Geert Uytterhoeven [this message]
2023-08-15 13:15 ` [PATCH v3 3/3] pinctrl: renesas: rza2: Add lock around pinctrl_generic{{add,remove}_group,{add,remove}_function} Biju Das
2023-08-17 12:47   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMuHMdWsUL5Om=+tPxktm8+=P0UmUzXXHOMTzaJxaCTY16G2=w@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).