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]
Date:	Mon, 25 Feb 2013 15:35:04 +0000
From:	Martyn Welch <martyn.welch@...com>
To:	"Emilio G. Cota" <cota@...ap.org>
CC:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Manohar Vanga <manohar.vanga@...il.com>,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vme: add missing put_device() after device_register()
 fails

On 13/02/13 18:47, Emilio G. Cota wrote:
> From: "Emilio G. Cota" <cota@...ap.org>
> 
> put_device() must be called after device_register() fails,
> since device_register() always initializes the refcount
> on the device structure.
> 
> Signed-off-by: Emilio G. Cota <cota@...ap.org>
> ---
>  drivers/vme/vme.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
> index 95a9f71..5e6c7d7 100644
> --- a/drivers/vme/vme.c
> +++ b/drivers/vme/vme.c
> @@ -1366,26 +1366,27 @@ static int __vme_register_driver_bus(struct vme_driver *drv,
>  		err = device_register(&vdev->dev);
>  		if (err)
>  			goto err_reg;
>  
>  		if (vdev->dev.platform_data) {
>  			list_add_tail(&vdev->drv_list, &drv->devices);
>  			list_add_tail(&vdev->bridge_list, &bridge->devices);
>  		} else
>  			device_unregister(&vdev->dev);
>  	}
>  	return 0;
>  
>  err_reg:
> +	put_device(&vdev->dev);
>  	kfree(vdev);
>  err_devalloc:
>  	list_for_each_entry_safe(vdev, tmp, &drv->devices, drv_list) {
>  		list_del(&vdev->drv_list);
>  		list_del(&vdev->bridge_list);
>  		device_unregister(&vdev->dev);
>  	}
>  	return err;
>  }

Acked-by: Martyn Welch <martyn.welch@...com>

(Sorry it took me so long to respond)

>  
>  static int __vme_register_driver(struct vme_driver *drv, unsigned int ndevs)
>  {
>  	struct vme_bridge *bridge;
> 


-- 
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms               | (3828642) at 100 Barbirolli Square
T +44(0)1327322748                     | Manchester, M2 3AB
E martyn.welch@...com                  | VAT:GB 927559189
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ