All of lore.kernel.org
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Changhuang Liang <changhuang.liang@starfivetech.com>
Cc: Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	 Jonathan Corbet <corbet@lwn.net>, Joel Stanley <joel@jms.id.au>,
	 Andrew Jeffery <andrew@codeconstruct.com.au>,
	Chia-Wei Wang <chiawei_wang@aspeedtech.com>,
	 Oskar Senft <osk@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Shuah Khan <skhan@linuxfoundation.org>,
	Jani Nikula <jani.nikula@intel.com>,
	 Vitaly Lubart <lubvital@gmail.com>,
	Hanjun Guo <guohanjun@huawei.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Alexander Usyskin <alexander.usyskin@intel.com>,
	 Jason Gunthorpe <jgg@ziepe.ca>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	 James Morse <james.morse@arm.com>,
	Paolo Abeni <pabeni@redhat.com>,
	 Stephen Hemminger <stephen@networkplumber.org>,
	Dave Penkler <dpenkler@gmail.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	 Dan Williams <djbw@kernel.org>,
	Mukesh Rathor <mrathor@linux.microsoft.com>,
	 Vladimir Oltean <vladimir.oltean@nxp.com>,
	Alexandra Winter <wintera@linux.ibm.com>,
	 Julian Braha <julianbraha@gmail.com>,
	Karthikeyan KS <karthiproffesional@gmail.com>,
	 Pengpeng Hou <pengpeng@iscas.ac.cn>,
	openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	 devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-aspeed@lists.ozlabs.org
Subject: Re: [PATCH v2 1/4] uart-routing: Add common UART routing framework
Date: Thu, 15 Oct 2026 02:52:58 -0700	[thread overview]
Message-ID: <atCibvmbCSTMTMYD@gmail.com> (raw)
In-Reply-To: <20260905102901.126035-2-changhuang.liang@starfivetech.com>

On Sat, Sep 05, 2026 at 03:28:58AM -0700, Changhuang Liang wrote:
> +ssize_t uart_routing_show(struct device *dev, struct device_attribute *attr,
> +                       char *buf)
> +{
> +     const struct uart_routing_selector *sel = to_uart_routing_selector(attr);
> +     struct uart_routing *routing = uart_routing_from_dev(dev);
> +     unsigned int val, pos;
> +     int len, ret;
> +
> +     ret = regmap_read(routing->regmap, sel->reg, &val);

It seems routing can be NULL here if the file is read while the device
is being unbound, and uart_routing_store() has the same problem.

I hit this while testing v2 on arm64 (next-20261008 with KASAN), and the
code is unchanged in v3.

        d=/sys/bus/platform/devices/$DEV
        drv=/sys/bus/platform/drivers/aspeed-uart-routing
        while :; do cat $d/uart1; done >/dev/null 2>&1 &
        while :; do echo $DEV > $drv/unbind; echo $DEV > $drv/bind; done

and then got:

    KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
    Internal error: Oops: 0000000096000006 [#1]  SMP
    pc : uart_routing_show+0x64/0x288 [uart_routing]
    Call trace:
     uart_routing_show+0x64/0x288 [uart_routing] (P)
     dev_attr_show+0x64/0xc0
     sysfs_kf_seq_show+0x21c/0x380
     kernfs_seq_show+0x138/0x1c8
     seq_read_iter+0x358/0xa30
     kernfs_fop_read_iter+0x438/0x500
     vfs_read+0x484/0x6f0

--breno

  parent reply	other threads:[~2026-10-15  9:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-05 10:28 [PATCH v2 0/4] Add support for StarFive JHB100 UART Routing Changhuang Liang
2026-09-05 10:28 ` [PATCH v2 1/4] uart-routing: Add common UART routing framework Changhuang Liang
2026-09-05 12:30   ` Julian Braha
2026-09-07  1:19     ` Changhuang Liang
2026-10-15  9:52   ` Breno Leitao [this message]
2026-09-05 10:28 ` [PATCH v2 2/4] soc: aspeed: Move UART routing driver to drivers/uart-routing Changhuang Liang
2026-09-05 10:29 ` [PATCH v2 3/4] dt-bindings: uart-routing: Add binding for StarFive JHB100 UART routing Changhuang Liang
2026-09-17 22:26   ` Rob Herring
2026-09-17 22:27   ` Rob Herring
2026-09-05 10:29 ` [PATCH v2 4/4] uart-routing: Add UART Routing driver for StarFive JHB100 SoC Changhuang Liang
2026-09-06  5:12   ` Randy Dunlap
2026-09-07  1:24     ` Changhuang Liang

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=atCibvmbCSTMTMYD@gmail.com \
    --to=leitao@debian.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.usyskin@intel.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=changhuang.liang@starfivetech.com \
    --cc=chiawei_wang@aspeedtech.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=djbw@kernel.org \
    --cc=dpenkler@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guohanjun@huawei.com \
    --cc=james.morse@arm.com \
    --cc=jani.nikula@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=jic23@kernel.org \
    --cc=joel@jms.id.au \
    --cc=julianbraha@gmail.com \
    --cc=karthiproffesional@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lubvital@gmail.com \
    --cc=mrathor@linux.microsoft.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=osk@google.com \
    --cc=p.zabel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=pengpeng@iscas.ac.cn \
    --cc=robh@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=stephen@networkplumber.org \
    --cc=vladimir.oltean@nxp.com \
    --cc=wintera@linux.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.