lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YVKeglYilJvqp1jk@kroah.com>
Date:   Tue, 28 Sep 2021 06:48:02 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     "David E. Box" <david.e.box@...ux.intel.com>
Cc:     lee.jones@...aro.org, hdegoede@...hat.com, mgross@...ux.intel.com,
        andriy.shevchenko@...ux.intel.com, srinivas.pandruvada@...el.com,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        platform-driver-x86@...r.kernel.org
Subject: Re: [PATCH 2/2] platform/x86: Add Intel Software Defined Silicon
 driver

On Mon, Sep 27, 2021 at 10:53:09AM -0700, David E. Box wrote:
> On Mon, 2021-09-27 at 06:03 +0200, Greg KH wrote:
> > On Sun, Sep 26, 2021 at 06:15:16PM -0700, David E. Box wrote:
> > > > > +static int sdsi_remove(struct platform_device *pdev)
> > > > > +{
> > > > > +       struct sdsi_priv *priv = platform_get_drvdata(pdev);
> > > > > +
> > > > > +       priv->dev_present = false;
> > > > > +       sysfs_remove_bin_file(&priv->pdev->dev.kobj, &priv->registers_bin_attr);
> > > > > +       misc_deregister(&priv->miscdev);
> > > > > +       kref_put(&priv->kref, sdsi_priv_release);
> > > > 
> > > > Why do you need a kref for a structure that already can be controlled by
> > > > a different lifetime rule?
> > > 
> > > Which rule am I missing? This kref allows the structure to remain in case the device is removed
> > > while the file is open.
> > 
> > This device is on a hardware bus that allows removal?
> 
> Well the device can be unbound. A test case covers this.

Great, where are these tests?  Why not add them to the kernel tree
itself in the proper location?

And in the real-world, who would ever unbind this?

> > Anyway, you now are dealing with lifetime rules of 3 structures all at
> > once, and the interactions between them is not very obvious.  It would
> > probably be simpler just to stick with 2, right?  You really only care
> > about the misc structure here.
> 
> In the case that the device is unbound, both the pdev and miscdev go away. Something has to outlive
> them in order to handle any open files still trying to use the ioctl.

I do not think that the miscdev goes away if the file handle is still
open, right?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ