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] [thread-next>] [day] [month] [year] [list]
Message-ID: <YuPK6cvPJvL+L3/t@kroah.com>
Date:   Fri, 29 Jul 2022 13:56:25 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
Cc:     kah.jing.lee@...el.com, linux-kernel@...r.kernel.org,
        arnd@...db.de, rafael.j.wysocki@...el.com, tien.sung.ang@...el.com,
        dinh.nguyen@...el.com, Zhou@...ah.com,
        Furong <furong.zhou@...el.com>, Vinod Koul <vkoul@...nel.org>,
        Bard Liao <yung-chuan.liao@...ux.intel.com>
Subject: Re: [PATCH v2 1/3] drivers: misc: intel_sysid: Add sysid from arch
 to drivers

On Fri, Jul 29, 2022 at 01:43:55PM +0200, Greg KH wrote:
> On Thu, Jul 28, 2022 at 11:53:33AM -0500, Pierre-Louis Bossart wrote:
> > 
> > 
> > On 7/28/22 10:59, Greg KH wrote:
> > > On Thu, Jul 28, 2022 at 10:37:37AM -0500, Pierre-Louis Bossart wrote:
> > >> Thanks for the review Greg,
> > >>
> > >>>> +static int intel_sysid_probe(struct platform_device *pdev)
> > >>>> +{
> > >>>> +	struct intel_sysid *sysid;
> > >>>> +	struct resource	*regs;
> > >>>> +
> > >>>> +	sysid = devm_kzalloc(&pdev->dev, sizeof(struct intel_sysid),
> > >>>> +		GFP_KERNEL);
> > >>>> +	if (!sysid)
> > >>>> +		return -ENOMEM;
> > >>>> +
> > >>>> +	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > >>>> +	if (!regs)
> > >>>> +		return -ENXIO;
> > >>>> +
> > >>>> +	sysid->regs = devm_ioremap_resource(&pdev->dev, regs);
> > >>>> +	if (IS_ERR(sysid->regs))
> > >>>> +		return PTR_ERR(sysid->regs);
> > >>>> +
> > >>>> +	platform_set_drvdata(pdev, sysid);
> > >>>> +
> > >>>> +	return devm_device_add_group(&pdev->dev, &intel_sysid_attr_group);
> > >>>
> > >>> You just raced with userspace and lost.  Please use the default group
> > >>> for the platform device.
> > >>>
> > >>> I need to go remove this function, it should not be used at all as it is
> > >>> broken.
> > >>
> > >> Can you elaborate on the issue and suggested replacement?
> > >>
> > >> We used this function for the SoundWire sysfs based on your review
> > >> comments (2 years ago?) that we should not muck with kobj, and that
> > >> function devm_device_add_group() is also used in a probe function.
> > > 
> > > Use the default_groups pointer in the driver structure.
> > 
> > did you mean dev_groups?
> 
> Yes, sorry, that's the correct name.
> 
> > I am not following the idea, for SoundWire all the attributes are really
> > device-specific or described by ACPI and cannot be hard-coded in the
> > driver structure.
> 
> That's what the is_visible() callback is for in the groups structure,
> you determine if the attribute is visable or not at runtime, you don't
> rely on the driver itself to add/remove attributes, that does not scale
> and again, is racy.

In looking at your attribute code, ick, you dynamically create a ton of
them.  But for the ones that you do not, you can just have the driver
core add them.  Let me make up a patch that shows what I am thinking
of...

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ