mirror of
https://github.com/amazingfate/rtl8723ds.git
synced 2026-01-26 21:03:15 +00:00
rtl8723ds: fix locking for (un)register
rtnl_is_locked() checks whether the lock is currently held by any task, not specifically by _this_ task so it is wrong to use it in the (un)register path. In both of these cases, examining the call stack shows that there is no way for rtnl_lock to be taken by the task running these functions, so remove the checks. Further, (un)register_netdev() have existed since the beginning of Git history so there's no reason for a version check here and we can always call the function that takes the lock itself and should never call the version which expects rtnl_lock to be held.
This commit is contained in:
@@ -1402,13 +1402,7 @@ int rtw_os_ndev_register(_adapter *adapter, const char *name)
|
||||
|
||||
/* Tell the network stack we exist */
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26))
|
||||
if (!rtnl_is_locked())
|
||||
ret = (register_netdev(ndev) == 0) ? _SUCCESS : _FAIL;
|
||||
else
|
||||
#endif
|
||||
ret = (register_netdevice(ndev) == 0) ? _SUCCESS : _FAIL;
|
||||
|
||||
ret = (register_netdev(ndev) == 0) ? _SUCCESS : _FAIL;
|
||||
if (ret == _SUCCESS)
|
||||
adapter->registered = 1;
|
||||
else
|
||||
@@ -1447,14 +1441,8 @@ void rtw_os_ndev_unregister(_adapter *adapter)
|
||||
rtw_cfg80211_ndev_res_unregister(adapter);
|
||||
#endif
|
||||
|
||||
if ((adapter->DriverState != DRIVER_DISAPPEAR) && netdev) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26))
|
||||
if (!rtnl_is_locked())
|
||||
unregister_netdev(netdev);
|
||||
else
|
||||
#endif
|
||||
unregister_netdevice(netdev);
|
||||
}
|
||||
if ((adapter->DriverState != DRIVER_DISAPPEAR) && netdev)
|
||||
unregister_netdev(netdev);
|
||||
|
||||
#if defined(CONFIG_IOCTL_CFG80211) && !defined(RTW_SINGLE_WIPHY)
|
||||
rtw_wiphy_unregister(adapter_to_wiphy(adapter));
|
||||
|
||||
Reference in New Issue
Block a user