public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Gui-Dong Han" <hanguidong02@gmail.com>
Cc: <gregkh@linuxfoundation.org>, <rafael@kernel.org>,
	<ysato@users.sourceforge.jp>, <dalias@libc.org>,
	<glaubitz@physik.fu-berlin.de>, <abelvesa@kernel.org>,
	<srini@kernel.org>, <s.nawrocki@samsung.com>,
	<nuno.sa@analog.com>, <driver-core@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>, <imx@lists.linux.dev>,
	<linux-hwmon@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<linux-sound@vger.kernel.org>, <linux-sh@vger.kernel.org>,
	"Wang Jiayue" <akaieurus@gmail.com>
Subject: Re: [PATCH 1/3] driver core: generalize driver_override in struct device
Date: Mon, 02 Mar 2026 11:05:39 +0100	[thread overview]
Message-ID: <DGS7NBNUSBI6.16D6UP28IAXYS@kernel.org> (raw)
In-Reply-To: <CALbr=LYqfhMi4eGp18r20XFzOWqRYCB8tO0mc_TAydb5cgbX-A@mail.gmail.com>

On Mon Mar 2, 2026 at 9:36 AM CET, Gui-Dong Han wrote:
> Applying the following diff fixes the KASAN issue. It was just a minor bug.
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index a8cb90577d10..09b98f02f559 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -2556,6 +2556,7 @@ static void device_release(struct kobject *kobj)
>         devres_release_all(dev);
>
>         kfree(dev->dma_range_map);
> +       kfree(dev->driver_override.name);
>
>         if (dev->release)
>                 dev->release(dev);
> @@ -2566,7 +2567,6 @@ static void device_release(struct kobject *kobj)
>         else
>                 WARN(1, KERN_ERR "Device '%s' does not have a
> release() function, it is broken and must be fixed. See
> Documentation/core-api/kobject.rst.\n",
>                         dev_name(dev));
> -       kfree(dev->driver_override.name);
>         kfree(p);
>  }

Yes, we must not access dev after the release callbacks has been called; no idea
how this kfree() ended up below. Thanks for catching!

> With this applied, along with the PCI driver diff from the WIP patch,
> the issue is resolved. I tested this on PCI and both PoCs no longer
> trigger KASAN. I also ran with other debug options enabled (lockdep,
> sleep inside atomic, etc.) and hit no warnings.
>
> I was working on a similar patch recently, but your version is better.
> Not returning the string directly provides better encapsulation and
> makes the API much harder to misuse.

Ah, right, I remember you mentioned that! If you want I can add your
Co-developed-by: to this patch to account for your work.

> Tested-by: Gui-Dong Han <hanguidong02@gmail.com>
> Reviewed-by: Gui-Dong Han <hanguidong02@gmail.com>

  reply	other threads:[~2026-03-02 10:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02  0:25 [PATCH 0/3] driver core: generalize driver_override infrastructure Danilo Krummrich
2026-03-02  0:25 ` [PATCH 1/3] driver core: generalize driver_override in struct device Danilo Krummrich
2026-03-02  7:35   ` Gui-Dong Han
2026-03-02  8:36   ` Gui-Dong Han
2026-03-02 10:05     ` Danilo Krummrich [this message]
2026-03-02 11:04       ` Gui-Dong Han
2026-03-02 10:00   ` Geert Uytterhoeven
2026-03-02 10:26     ` Danilo Krummrich
2026-03-02 10:38       ` Geert Uytterhoeven
2026-03-02 11:03         ` Danilo Krummrich
2026-03-02 10:23   ` Armin Wolf
2026-03-02 16:28     ` Danilo Krummrich
2026-03-02  0:25 ` [PATCH 2/3] hwmon: axi-fan: don't use driver_override as IRQ name Danilo Krummrich
2026-03-02  0:51   ` Guenter Roeck
2026-03-02 10:00     ` Danilo Krummrich
2026-03-02 11:02     ` Nuno Sá
2026-03-02  0:25 ` [PATCH 3/3] driver core: platform: use generic driver_override infrastructure Danilo Krummrich
2026-03-02  8:55   ` Gui-Dong Han
2026-03-02  9:41 ` [PATCH 0/3] driver core: generalize " Gui-Dong Han
2026-03-02 10:12   ` Danilo Krummrich
2026-03-02 10:59     ` Gui-Dong Han

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=DGS7NBNUSBI6.16D6UP28IAXYS@kernel.org \
    --to=dakr@kernel.org \
    --cc=abelvesa@kernel.org \
    --cc=akaieurus@gmail.com \
    --cc=dalias@libc.org \
    --cc=driver-core@lists.linux.dev \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=hanguidong02@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=rafael@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=srini@kernel.org \
    --cc=ysato@users.sourceforge.jp \
    /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