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: <YxCIam9OS6fWpoA3@kroah.com>
Date:   Thu, 1 Sep 2022 12:24:42 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Jiasheng Jiang <jiasheng@...as.ac.cn>
Cc:     hdegoede@...hat.com, arnd@...db.de, linux-kernel@...r.kernel.org
Subject: Re: Re: [PATCH v2 1/2] virt: vbox: Add check for device_create_file

On Thu, Sep 01, 2022 at 06:16:49PM +0800, Jiasheng Jiang wrote:
> On Thu, Sep 01, 2022 at 05:39:46PM +0800, Greg KH wrote:
> >> -	device_create_file(dev, &dev_attr_host_version);
> >> -	device_create_file(dev, &dev_attr_host_features);
> >> +
> >> +	ret = device_create_file(gdev->dev, &dev_attr_host_features);
> >> +	if (ret)
> >> +		goto err_unregister_misc_device_user;
> >> +	ret = device_create_file(gdev->dev, &dev_attr_host_version);
> >> +	if (ret)
> >> +		goto err_remove_file_features;
> >>  
> >>  	vbg_info("vboxguest: misc device minor %d, IRQ %d, I/O port %x, MMIO at %pap (size %pap)\n",
> >>  		 gdev->misc_device.minor, pci->irq, gdev->io_port,
> >> @@ -399,6 +404,8 @@ static int vbg_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
> >>  
> >>  	return 0;
> >>  
> >> +err_remove_file_features:
> >> +	device_remove_file(gdev->dev, &dev_attr_host_features);
> > Please make a patch series that is linked together, the one you just did
> > was not properly threaded at all (hint, use git send-email).
> > 
> > And again, this is not the correct way to solve this issue, use a
> > default attribute group for the driver instead.  No driver should ever
> > be adding or removing files individually like this.
> 
> Need I use the group to replace the individually removal in
> vbg_pci_remove() too?

If you use a group, the driver core handles all of the adding and
removing automatically for you.  Look at other commits that set the
default groups attribute for a driver for examples.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ