From: Johan Hovold <johan@kernel.org>
To: Jason Wang <jasowang@redhat.com>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, "Pawel Moll" <pawel.moll@arm.com>
Subject: Re: [PATCH] virtio-mmio: fix device release warning on module unload
Date: Mon, 27 Apr 2026 17:01:58 +0200 [thread overview]
Message-ID: <ae96Zsike81dBxTS@hovoldconsulting.com> (raw)
In-Reply-To: <CACGkMEvJ4CZt9mVhn5TRCz5yCYzY_yHNFh8pbT4hOmJoWDiKOA@mail.gmail.com>
On Mon, Apr 27, 2026 at 12:16:47PM +0800, Jason Wang wrote:
> On Fri, Apr 24, 2026 at 6:48 PM Johan Hovold <johan@kernel.org> wrote:
> >
> > Driver core expects devices to be allocated dynamically and complains
> > loudly when a device that lacks a release function is freed.
> >
> > Use __root_device_register() to allocate and register the root device
> > instead of open coding using a static device.
> > -static struct device vm_cmdline_parent = {
> > - .init_name = "virtio-mmio-cmdline",
> > -};
> > +static struct device *vm_cmdline_parent;
>
> vm_cmdline_get() is the .get callback for the device module parameter.
> It is invoked when userspace reads
> /sys/module/virtio_mmio/parameters/device. This function uses
> vm_cmdline_parent unconditionally, without checking whether the device
> has been registered. This would cause NULL pointer dereference.
Indeed, Sashiko flagged this as well. Just sent a v2 here:
https://lore.kernel.org/r/20260427143710.14702-1-johan@kernel.org
Johan
prev parent reply other threads:[~2026-04-27 15:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 10:48 [PATCH] virtio-mmio: fix device release warning on module unload Johan Hovold
2026-04-27 4:16 ` Jason Wang
2026-04-27 15:01 ` Johan Hovold [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=ae96Zsike81dBxTS@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=eperezma@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pawel.moll@arm.com \
--cc=stable@vger.kernel.org \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox