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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <85abb9009642c3a13321970c04f73cf0cf91c2e3.camel@sipsolutions.net>
Date:   Wed, 20 Jan 2021 19:03:23 +0100
From:   Johannes Berg <johannes@...solutions.net>
To:     linux-wireless@...r.kernel.org
Cc:     netdev@...r.kernel.org, Oliver Neukum <oneukum@...e.com>
Subject: Re: [PATCH v2] cfg80211: avoid holding the RTNL when calling the
 driver

Hi Oliver,


Could you take a look at these bits to see if that's fine with you? I'd
like to merge it through mac80211-next (pending some logistics with a
conflict)

> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> index 1447da1d5729..47c4c1182ef1 100644
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -1560,6 +1560,8 @@ void usbnet_disconnect (struct usb_interface *intf)
>  	struct usbnet		*dev;
>  	struct usb_device	*xdev;
>  	struct net_device	*net;
> +	const struct driver_info *info;
> +	void (*unregdev)(struct net_device *);
>  
>  	dev = usb_get_intfdata(intf);
>  	usb_set_intfdata(intf, NULL);
> @@ -1574,7 +1576,10 @@ void usbnet_disconnect (struct usb_interface *intf)
>  		   dev->driver_info->description);
>  
>  	net = dev->net;
> -	unregister_netdev (net);
> +
> +	info = dev->driver_info;
> +	unregdev = info->unregister_netdev ?: unregister_netdev;
> +	unregdev(net);
>  
>  	cancel_work_sync(&dev->kevent);
>  
> @@ -1627,6 +1632,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
>  	int				status;
>  	const char			*name;
>  	struct usb_driver 	*driver = to_usb_driver(udev->dev.driver);
> +	int (*regdev)(struct net_device *);
>  
>  	/* usbnet already took usb runtime pm, so have to enable the feature
>  	 * for usb interface, otherwise usb_autopm_get_interface may return
> @@ -1646,6 +1652,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
>  	xdev = interface_to_usbdev (udev);
>  	interface = udev->cur_altsetting;
>  
> +	regdev = info->register_netdev ?: register_netdev;
> +
>  	status = -ENOMEM;
>  
>  	// set up our own records
> @@ -1768,7 +1776,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
>  		}
>  	}
>  
> -	status = register_netdev (net);
> +	status = regdev(net);
>  	if (status)
>  		goto out5;
>  	netif_info(dev, probe, dev->net,

[...]

> diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
> index 9fe77556858e..b646d4295cfd 100644
> --- a/drivers/net/wireless/rndis_wlan.c
> +++ b/drivers/net/wireless/rndis_wlan.c
> @@ -3598,6 +3598,8 @@ static const struct driver_info	bcm4320b_info = {
>  	.stop =		rndis_wlan_stop,
>  	.early_init =	bcm4320b_early_init,
>  	.indication =	rndis_wlan_indication,
> +	.register_netdev = cfg80211_register_netdev,
> +	.unregister_netdev = cfg80211_unregister_netdev,
>  };
>  
>  static const struct driver_info	bcm4320a_info = {
> @@ -3613,6 +3615,8 @@ static const struct driver_info	bcm4320a_info = {
>  	.stop =		rndis_wlan_stop,
>  	.early_init =	bcm4320a_early_init,
>  	.indication =	rndis_wlan_indication,
> +	.register_netdev = cfg80211_register_netdev,
> +	.unregister_netdev = cfg80211_unregister_netdev,
>  };
>  
>  static const struct driver_info rndis_wlan_info = {
> @@ -3628,6 +3632,8 @@ static const struct driver_info rndis_wlan_info = {
>  	.stop =		rndis_wlan_stop,
>  	.early_init =	unknown_early_init,
>  	.indication =	rndis_wlan_indication,
> +	.register_netdev = cfg80211_register_netdev,
> +	.unregister_netdev = cfg80211_unregister_netdev,
>  };
>  
>  /*-------------------------------------------------------------------------*/

[...]

> diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
> index 88a7673894d5..11e57803acf9 100644
> --- a/include/linux/usb/usbnet.h
> +++ b/include/linux/usb/usbnet.h
> @@ -165,6 +165,12 @@ struct driver_info {
>  	/* rx mode change (device changes address list filtering) */
>  	void	(*set_rx_mode)(struct usbnet *dev);
>  
> +	/* register netdev - defaults to register_netdev() */
> +	int	(*register_netdev)(struct net_device *dev);
> +
> +	/* unregister netdev - defaults to unregister_netdev() */
> +	void	(*unregister_netdev)(struct net_device *dev);
> +
>  	/* for new devices, use the descriptor-reading code instead */
>  	int		in;		/* rx endpoint */
>  	int		out;		/* tx endpoint *

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ