mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Guenter Roeck <groeck@google.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Guenter Roeck <groeck@chromium.org>,
	Wei-Ning Huang <wnhuang@google.com>
Subject: Re: drivers/firmware/google/vpd.c: duplicate sysfs file
Date: Mon, 13 Nov 2017 20:23:17 +0100	[thread overview]
Message-ID: <20171113192317.GA27109@kroah.com> (raw)
In-Reply-To: <CABXOdTeBzGMrSquEyhCn1Oh4Fg_AfuoSOgUrtVC+zxLxOxDzmw@mail.gmail.com>

On Mon, Nov 13, 2017 at 11:09:21AM -0800, Guenter Roeck wrote:
> On Mon, Nov 13, 2017 at 11:04 AM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> >
> > On Mon, Nov 13, 2017 at 10:18:35AM -0800, Randy Dunlap wrote:
> > > On 11/13/2017 06:41 AM, Guenter Roeck wrote:
> > > >
> > > >
> > > > On Sun, Nov 12, 2017 at 10:36 PM, Randy Dunlap <rdunlap@infradead.org <mailto:rdunlap@infradead.org>> wrote:
> > > >
> > > >     sysfs: cannot create duplicate filename '/devices/platform/vpd'
> > > >
> > > >     on the second load of this driver.  I.e.,
> > > >
> > > >     modprobe vpd-sysfs
> > > >     rmmod vpd-sysfs
> > > >     modprobe vpd-sysfs
> > > >     [boom]
> > > >
> > > > Neither the platform device nor the platform driver driver are ever unregistered, so this isn't entirely surprising. I'll try to reproduce and send a patch.
> > >
> > >
> > > Seems to be a common theme:
> > >
> > > google> grep --color=never "platform.*register" *.c
> > > coreboot_table-acpi.c:        return platform_driver_register(&coreboot_table_acpi_driver);
> > > coreboot_table-of.c:  return platform_driver_register(&coreboot_table_of_driver);
> >
> > These are not unloadable (for better or worse) - they do not have
> > module_exit() in them.
> >
> > >
> > > gsmi.c:       gsmi_dev.pdev = platform_device_register_full(&gsmi_dev_info);
> > > gsmi.c:       platform_device_unregister(gsmi_dev.pdev);
> > > gsmi.c:       platform_device_unregister(gsmi_dev.pdev);
> > > [looks good]
> > >
> > > memconsole-coreboot.c:        pdev = platform_device_register_simple("memconsole", -1, NULL, 0);
> > > memconsole-coreboot.c:        platform_driver_register(&memconsole_driver);
> >
> > Same here: not unloadable.
> >
> > >
> > > vpd.c:        pdev = platform_device_register_simple("vpd", -1, NULL, 0);
> > > vpd.c:        platform_driver_register(&vpd_driver);
> >
> > Arguably this should not even be a platform driver, there is no hardware
> > behind it. I was planning on purring some notifiers into coreboot table
> > driver and using notifiers to attach vpd to them. -ENOTIME though.
> >
> Two options for now: clean it up and make it unloadable, or make it bool
> and drop the exit function. Any preference ?
> 
> The problem is easy to reproduce even with the driver is built into
> the kernel with a simple unbind/bind sequence. And after the unbind,
> it is easy to crash the system since the sysfs attributes are still there.

The kernel should not 'crash', just spit out a nasty warning, right?

thanks,

greg k-h

  reply	other threads:[~2017-11-13 19:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13  6:36 Randy Dunlap
     [not found] ` <CABXOdTfJkdWzqptbqkbJqNtxx5+qeW=+4CZFUG9UxJ6QADAsRw@mail.gmail.com>
2017-11-13 18:18   ` Randy Dunlap
2017-11-13 19:04     ` Dmitry Torokhov
2017-11-13 19:09       ` Guenter Roeck
2017-11-13 19:23         ` Greg Kroah-Hartman [this message]
2017-11-13 20:14           ` Guenter Roeck
2017-11-13 22:01             ` Dmitry Torokhov
2017-11-13 22:24               ` Guenter Roeck
2017-11-13 22:26                 ` Dmitry Torokhov

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=20171113192317.GA27109@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=groeck@chromium.org \
    --cc=groeck@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=wnhuang@google.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

all inboxes | Powered by JetHome®