All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Armin Wolf <W_Armin@gmx.de>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
	"Shuangpeng Bai" <shuangpeng.kernel@gmail.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [BUG] KASAN: slab-use-after-free in _copy_to_user from platform/x86/dell-smbios-wmi
Date: Tue, 16 Jun 2026 08:14:53 +0530	[thread overview]
Message-ID: <2026061608-moisture-marathon-bdb4@gregkh> (raw)
In-Reply-To: <fa9833ee-f86e-491b-a1fa-625011a1ec47@gmx.de>

On Tue, Jun 16, 2026 at 12:28:05AM +0200, Armin Wolf wrote:
> Am 15.06.26 um 23:00 schrieb Arnd Bergmann:
> 
> > On Mon, Jun 15, 2026, at 22:21, Armin Wolf wrote:
> > > Am 15.06.26 um 15:30 schrieb gregkh@linuxfoundation.org:
> > > 
> > > Its a "unbind" operation, either from sysfs or started by the WMI driver core.
> > > 
> > > I do not think that this has something to do with the module reference counter,
> > The misc_device reference count. The module reference count is
> > protected by the wmi_driver object.
> > 
> > > because the UAF is triggered by the device state container being freed:
> > > 
> > > 1. devm_kzalloc() + misc_register()
> > > 2. open(), uses data previously allocated with devm_kzalloc()
> > > 3. unbind, misc_unregister() + freeing of state container data.
> > > 4. read(), access to already freed state container data.
> > > 
> > > I assume that misc_unregister() does not prevent read(), write() and ioctl()
> > > on already opened file descriptors? If yes then i think a RW-lock inside the
> > > driver would be necessary to synchronize the removal of the misc device with
> > > any outstanding read()/ioctl() operations.
> > A get_device() in ->open() should prevent the misc_device from
> > going away during read() and ioctl(). You need to put_device() in
> > ->release() then.
> > 
> > If the driver->probe() function takes a reference on the wmi_device,
> > that prevents it from going away underneath the misc_device.
> > 
> >        Arnd
> 
> IMHO this is not the problem here, the issue is that file operations
> continue to access struct wmi_smbios_priv even after misc_unregister()
> was called during driver unbind.
> 
> The UAF is not the WMI or the misc device, it is the driver state container.

Yes, this is the "classic" issue that the many revisions and discussions
around the "revocable" patch series was attempting to resolve.  Look at
the discussions on the lists for this, and the cros_ec_chardev patch
series for ways to potentially resolve this.

In other words, it's a well known problem, and people are working on it,
but it will take work for each driver to resolve it.  For
non-removable-bus devices, it's not a big deal as this can not happen in
the real world, so don't worry too much about it now.

thanks,

greg k-h

      reply	other threads:[~2026-06-16  2:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-14 19:15 [BUG] KASAN: slab-use-after-free in _copy_to_user from platform/x86/dell-smbios-wmi Shuangpeng Bai
2026-06-15 12:19 ` Armin Wolf
2026-06-15 13:30   ` gregkh
2026-06-15 15:28     ` Arnd Bergmann
2026-06-15 20:21     ` Armin Wolf
2026-06-15 21:00       ` Arnd Bergmann
2026-06-15 22:28         ` Armin Wolf
2026-06-16  2:44           ` Greg Kroah-Hartman [this message]

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=2026061608-moisture-marathon-bdb4@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=Dell.Client.Kernel@dell.com \
    --cc=W_Armin@gmx.de \
    --cc=arnd@arndb.de \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=shuangpeng.kernel@gmail.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.