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: <SN6PR11MB31032B4182769288DC5F5A0ED99B9@SN6PR11MB3103.namprd11.prod.outlook.com>
Date:   Sun, 28 Feb 2021 20:06:44 +0000
From:   "Chen, Mike Ximing" <mike.ximing.chen@...el.com>
To:     Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
        Johan Hovold <johan@...nel.org>
CC:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>
Subject: RE: [PATCH 2/7] USB: serial: xr: use a table for device-specific
 settings



> -----Original Message-----
> From: Mauro Carvalho Chehab <mchehab@...nel.org> On Behalf Of Mauro
> Carvalho Chehab
> 
>  static int xr_probe(struct usb_serial *serial, const struct usb_device_id *id)
>  {
> +	struct xr_port_private *port_priv;
> +
>  	/* Don't bind to control interface */
>  	if (serial->interface->cur_altsetting->desc.bInterfaceNumber == 0)
>  		return -ENODEV;
> 
> +	port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL);
> +	if (!port_priv)
> +		return -ENOMEM;
> +
> +	port_priv->model = id->driver_info;
> +
> +	usb_set_serial_data(serial, port_priv);
> +
>  	return 0;
>  }
> 
> +static void xr_disconnect(struct usb_serial *serial)
> +{
> +	struct xr_port_private *port_priv = usb_get_serial_data(serial);
> +
> +	kfree(port_priv);
> +	usb_set_serial_data(serial, 0);

Probably a nitpick, but shouldn't usb_set_serral_data() be called before kfree()?

> +}
> +
>  static const struct usb_device_id id_table[] = {
> -	{ USB_DEVICE(0x04e2, 0x1410) }, /* XR21V141X */
> +	{ USB_DEVICE(0x04e2, 0x1410), .driver_info = XR21V141X},
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(usb, id_table);
> @@ -566,6 +640,7 @@ static struct usb_serial_driver xr_device = {
>  	.id_table		= id_table,
>  	.num_ports		= 1,
>  	.probe			= xr_probe,
> +	.disconnect		= xr_disconnect,
>  	.open			= xr_open,
>  	.close			= xr_close,
>  	.break_ctl		= xr_break_ctl,
> --
> 2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ