Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:

1) Fix a reference to a module parameter which was lost during the
GREv6 receive path rewrite, from Alexey Kodanev.

2) Fix deref before NULL check in ipheth, from Gustavo A. R. Silva.

3) RCU read lock imbalance in tun_build_skb(), from Xin Long.

4) Some stragglers from the mac80211 folks:

a) Timer conversions from Kees Cook

b) Fix some sequencing issue when cfg80211 is built statically,
from Johannes Berg

c) Memory leak in mac80211_hwsim, from Ben Hutchings.

5) Add new qmi_wwan device ID, from Sebastian Sjoholm.

6) Fix use after free in tipc, from Jon Maloy.

7) Missing kdoc in nfp driver, from Jakub Kicinski.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
nfp: flower: add missing kdoc
tipc: fix access of released memory
net: qmi_wwan: add Quectel BG96 2c7c:0296
mlxsw: spectrum: Do not try to create non-existing ports during unsplit
mac80211: properly free requested-but-not-started TX agg sessions
mac80211_hwsim: Fix memory leak in hwsim_new_radio_nl()
cfg80211: initialize regulatory keys/database later
mac80211: aggregation: Convert timers to use timer_setup()
nl80211: don't expose wdev->ssid for most interfaces
mac80211: Convert timers to use timer_setup()
net: vxge: Fix some indentation issues
net: ena: fix race condition between device reset and link up setup
r8169: use same RTL8111EVL green settings as in vendor driver
r8169: fix RTL8111EVL EEE and green settings
tun: fix rcu_read_lock imbalance in tun_build_skb
tcp: when scheduling TLP, time of RTO should account for current ACK
usbnet: ipheth: fix potential null pointer dereference in ipheth_carrier_set
gre6: use log_ecn_error module parameter in ip6_tnl_rcv()

+220 -176
+9 -2
drivers/net/ethernet/amazon/ena/ena_netdev.c
··· 2579 2579 bool wd_state; 2580 2580 int rc; 2581 2581 2582 + set_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags); 2582 2583 rc = ena_device_init(ena_dev, adapter->pdev, &get_feat_ctx, &wd_state); 2583 2584 if (rc) { 2584 2585 dev_err(&pdev->dev, "Can not initialize device\n"); ··· 2592 2591 dev_err(&pdev->dev, "Validation of device parameters failed\n"); 2593 2592 goto err_device_destroy; 2594 2593 } 2594 + 2595 + clear_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags); 2596 + /* Make sure we don't have a race with AENQ Links state handler */ 2597 + if (test_bit(ENA_FLAG_LINK_UP, &adapter->flags)) 2598 + netif_carrier_on(adapter->netdev); 2595 2599 2596 2600 rc = ena_enable_msix_and_set_admin_interrupts(adapter, 2597 2601 adapter->num_queues); ··· 2624 2618 ena_com_admin_destroy(ena_dev); 2625 2619 err: 2626 2620 clear_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags); 2627 - 2621 + clear_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags); 2628 2622 dev_err(&pdev->dev, 2629 2623 "Reset attempt failed. Can not reset the device\n"); 2630 2624 ··· 3501 3495 if (status) { 3502 3496 netdev_dbg(adapter->netdev, "%s\n", __func__); 3503 3497 set_bit(ENA_FLAG_LINK_UP, &adapter->flags); 3504 - netif_carrier_on(adapter->netdev); 3498 + if (!test_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags)) 3499 + netif_carrier_on(adapter->netdev); 3505 3500 } else { 3506 3501 clear_bit(ENA_FLAG_LINK_UP, &adapter->flags); 3507 3502 netif_carrier_off(adapter->netdev);
+2 -1
drivers/net/ethernet/amazon/ena/ena_netdev.h
··· 272 272 ENA_FLAG_DEV_UP, 273 273 ENA_FLAG_LINK_UP, 274 274 ENA_FLAG_MSIX_ENABLED, 275 - ENA_FLAG_TRIGGER_RESET 275 + ENA_FLAG_TRIGGER_RESET, 276 + ENA_FLAG_ONGOING_RESET 276 277 }; 277 278 278 279 /* adapter specific private data structure */
+7 -1
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
··· 3142 3142 if (!mlxsw_sp->ports) 3143 3143 return -ENOMEM; 3144 3144 3145 - mlxsw_sp->port_to_module = kcalloc(max_ports, sizeof(u8), GFP_KERNEL); 3145 + mlxsw_sp->port_to_module = kmalloc_array(max_ports, sizeof(int), 3146 + GFP_KERNEL); 3146 3147 if (!mlxsw_sp->port_to_module) { 3147 3148 err = -ENOMEM; 3148 3149 goto err_port_to_module_alloc; 3149 3150 } 3150 3151 3151 3152 for (i = 1; i < max_ports; i++) { 3153 + /* Mark as invalid */ 3154 + mlxsw_sp->port_to_module[i] = -1; 3155 + 3152 3156 err = mlxsw_sp_port_module_info_get(mlxsw_sp, i, &module, 3153 3157 &width, &lane); 3154 3158 if (err) ··· 3220 3216 3221 3217 for (i = 0; i < count; i++) { 3222 3218 local_port = base_port + i * 2; 3219 + if (mlxsw_sp->port_to_module[local_port] < 0) 3220 + continue; 3223 3221 module = mlxsw_sp->port_to_module[local_port]; 3224 3222 3225 3223 mlxsw_sp_port_create(mlxsw_sp, local_port, false, module,
+1 -1
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
··· 152 152 const struct mlxsw_bus_info *bus_info; 153 153 unsigned char base_mac[ETH_ALEN]; 154 154 struct mlxsw_sp_upper *lags; 155 - u8 *port_to_module; 155 + int *port_to_module; 156 156 struct mlxsw_sp_sb *sb; 157 157 struct mlxsw_sp_bridge *bridge; 158 158 struct mlxsw_sp_router *router;
+18 -19
drivers/net/ethernet/neterion/vxge/vxge-main.c
··· 1530 1530 vxge_debug_init(VXGE_ERR, 1531 1531 "vxge_hw_vpath_reset failed for" 1532 1532 "vpath:%d", vp_id); 1533 - return status; 1533 + return status; 1534 1534 } 1535 1535 } else 1536 1536 return VXGE_HW_FAIL; ··· 1950 1950 * for all VPATHs. The h/w only uses the lowest numbered VPATH 1951 1951 * when steering frames. 1952 1952 */ 1953 - for (index = 0; index < vdev->no_of_vpath; index++) { 1953 + for (index = 0; index < vdev->no_of_vpath; index++) { 1954 1954 status = vxge_hw_vpath_rts_rth_set( 1955 1955 vdev->vpaths[index].handle, 1956 1956 vdev->config.rth_algorithm, 1957 1957 &hash_types, 1958 1958 vdev->config.rth_bkt_sz); 1959 - if (status != VXGE_HW_OK) { 1959 + if (status != VXGE_HW_OK) { 1960 1960 vxge_debug_init(VXGE_ERR, 1961 1961 "RTH configuration failed for vpath:%d", 1962 1962 vdev->vpaths[index].device_id); 1963 1963 return status; 1964 - } 1965 - } 1964 + } 1965 + } 1966 1966 1967 1967 return status; 1968 1968 } ··· 1991 1991 vxge_debug_init(VXGE_ERR, 1992 1992 "vxge_hw_vpath_reset failed for " 1993 1993 "vpath:%d", i); 1994 - return status; 1994 + return status; 1995 1995 } 1996 1996 } 1997 1997 } ··· 2474 2474 switch (msix_idx) { 2475 2475 case 0: 2476 2476 snprintf(vdev->desc[intr_cnt], VXGE_INTR_STRLEN, 2477 - "%s:vxge:MSI-X %d - Tx - fn:%d vpath:%d", 2477 + "%s:vxge:MSI-X %d - Tx - fn:%d vpath:%d", 2478 2478 vdev->ndev->name, 2479 2479 vdev->entries[intr_cnt].entry, 2480 2480 pci_fun, vp_idx); 2481 2481 ret = request_irq( 2482 - vdev->entries[intr_cnt].vector, 2482 + vdev->entries[intr_cnt].vector, 2483 2483 vxge_tx_msix_handle, 0, 2484 2484 vdev->desc[intr_cnt], 2485 2485 &vdev->vpaths[vp_idx].fifo); 2486 - vdev->vxge_entries[intr_cnt].arg = 2486 + vdev->vxge_entries[intr_cnt].arg = 2487 2487 &vdev->vpaths[vp_idx].fifo; 2488 2488 irq_req = 1; 2489 2489 break; 2490 2490 case 1: 2491 2491 snprintf(vdev->desc[intr_cnt], VXGE_INTR_STRLEN, 2492 - "%s:vxge:MSI-X %d - Rx - fn:%d vpath:%d", 2492 + "%s:vxge:MSI-X %d - Rx - fn:%d vpath:%d", 2493 2493 vdev->ndev->name, 2494 2494 vdev->entries[intr_cnt].entry, 2495 2495 pci_fun, vp_idx); 2496 2496 ret = request_irq( 2497 - vdev->entries[intr_cnt].vector, 2498 - vxge_rx_msix_napi_handle, 2499 - 0, 2497 + vdev->entries[intr_cnt].vector, 2498 + vxge_rx_msix_napi_handle, 0, 2500 2499 vdev->desc[intr_cnt], 2501 2500 &vdev->vpaths[vp_idx].ring); 2502 - vdev->vxge_entries[intr_cnt].arg = 2501 + vdev->vxge_entries[intr_cnt].arg = 2503 2502 &vdev->vpaths[vp_idx].ring; 2504 2503 irq_req = 1; 2505 2504 break; ··· 2511 2512 vxge_rem_msix_isr(vdev); 2512 2513 vdev->config.intr_type = INTA; 2513 2514 vxge_debug_init(VXGE_ERR, 2514 - "%s: Defaulting to INTA" 2515 - , vdev->ndev->name); 2516 - goto INTA_MODE; 2515 + "%s: Defaulting to INTA", 2516 + vdev->ndev->name); 2517 + goto INTA_MODE; 2517 2518 } 2518 2519 2519 2520 if (irq_req) { ··· 4504 4505 if (status != VXGE_HW_OK) { 4505 4506 vxge_debug_init(VXGE_ERR, 4506 4507 "Failed to initialize device (%d)", status); 4507 - ret = -EINVAL; 4508 - goto _exit3; 4508 + ret = -EINVAL; 4509 + goto _exit3; 4509 4510 } 4510 4511 4511 4512 if (VXGE_FW_VER(ll_config->device_hw_info.fw_version.major,
+1
drivers/net/ethernet/netronome/nfp/flower/offload.c
··· 315 315 * @app: Pointer to the APP handle 316 316 * @netdev: netdev structure. 317 317 * @flow: TC flower classifier offload structure. 318 + * @egress: NFP netdev is the egress. 318 319 * 319 320 * Adds a new flow to the repeated hash structure and action payload. 320 321 *
+11 -6
drivers/net/ethernet/realtek/r8169.c
··· 3789 3789 rtl_writephy(tp, 0x1f, 0x0000); 3790 3790 3791 3791 /* EEE setting */ 3792 - rtl_w0w1_eri(tp, 0x1b0, ERIAR_MASK_1111, 0x0000, 0x0003, ERIAR_EXGMAC); 3792 + rtl_w0w1_eri(tp, 0x1b0, ERIAR_MASK_1111, 0x0003, 0x0000, ERIAR_EXGMAC); 3793 3793 rtl_writephy(tp, 0x1f, 0x0005); 3794 3794 rtl_writephy(tp, 0x05, 0x8b85); 3795 - rtl_w0w1_phy(tp, 0x06, 0x0000, 0x2000); 3795 + rtl_w0w1_phy(tp, 0x06, 0x2000, 0x0000); 3796 3796 rtl_writephy(tp, 0x1f, 0x0004); 3797 3797 rtl_writephy(tp, 0x1f, 0x0007); 3798 3798 rtl_writephy(tp, 0x1e, 0x0020); 3799 - rtl_w0w1_phy(tp, 0x15, 0x0000, 0x0100); 3799 + rtl_w0w1_phy(tp, 0x15, 0x0100, 0x0000); 3800 3800 rtl_writephy(tp, 0x1f, 0x0002); 3801 3801 rtl_writephy(tp, 0x1f, 0x0000); 3802 3802 rtl_writephy(tp, 0x0d, 0x0007); 3803 3803 rtl_writephy(tp, 0x0e, 0x003c); 3804 3804 rtl_writephy(tp, 0x0d, 0x4007); 3805 - rtl_writephy(tp, 0x0e, 0x0000); 3805 + rtl_writephy(tp, 0x0e, 0x0006); 3806 3806 rtl_writephy(tp, 0x0d, 0x0000); 3807 3807 3808 3808 /* Green feature */ 3809 3809 rtl_writephy(tp, 0x1f, 0x0003); 3810 - rtl_w0w1_phy(tp, 0x19, 0x0000, 0x0001); 3811 - rtl_w0w1_phy(tp, 0x10, 0x0000, 0x0400); 3810 + rtl_w0w1_phy(tp, 0x19, 0x0001, 0x0000); 3811 + rtl_w0w1_phy(tp, 0x10, 0x0400, 0x0000); 3812 3812 rtl_writephy(tp, 0x1f, 0x0000); 3813 + rtl_writephy(tp, 0x1f, 0x0005); 3814 + rtl_w0w1_phy(tp, 0x01, 0x0100, 0x0000); 3815 + rtl_writephy(tp, 0x1f, 0x0000); 3816 + /* soft-reset phy */ 3817 + rtl_writephy(tp, MII_BMCR, BMCR_RESET | BMCR_ANENABLE | BMCR_ANRESTART); 3813 3818 3814 3819 /* Broken BIOS workaround: feed GigaMAC registers with MAC address. */ 3815 3820 rtl_rar_exgmac_set(tp, tp->dev->dev_addr);
+2 -1
drivers/net/tun.c
··· 1485 1485 err = xdp_do_redirect(tun->dev, &xdp, xdp_prog); 1486 1486 if (err) 1487 1487 goto err_redirect; 1488 + rcu_read_unlock(); 1488 1489 return NULL; 1489 1490 case XDP_TX: 1490 1491 xdp_xmit = true; ··· 1518 1517 if (xdp_xmit) { 1519 1518 skb->dev = tun->dev; 1520 1519 generic_xdp_tx(skb, xdp_prog); 1521 - rcu_read_lock(); 1520 + rcu_read_unlock(); 1522 1521 return NULL; 1523 1522 } 1524 1523
+4 -1
drivers/net/usb/ipheth.c
··· 291 291 292 292 static int ipheth_carrier_set(struct ipheth_device *dev) 293 293 { 294 - struct usb_device *udev = dev->udev; 294 + struct usb_device *udev; 295 295 int retval; 296 + 296 297 if (!dev) 297 298 return 0; 298 299 if (!dev->confirmed_pairing) 299 300 return 0; 301 + 302 + udev = dev->udev; 300 303 retval = usb_control_msg(udev, 301 304 usb_rcvctrlpipe(udev, IPHETH_CTRL_ENDP), 302 305 IPHETH_CMD_CARRIER_CHECK, /* request */
+1
drivers/net/usb/qmi_wwan.c
··· 1239 1239 {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */ 1240 1240 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ 1241 1241 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */ 1242 + {QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */ 1242 1243 1243 1244 /* 4. Gobi 1000 devices */ 1244 1245 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
+4 -1
drivers/net/wireless/mac80211_hwsim.c
··· 3108 3108 { 3109 3109 struct hwsim_new_radio_params param = { 0 }; 3110 3110 const char *hwname = NULL; 3111 + int ret; 3111 3112 3112 3113 param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG]; 3113 3114 param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE]; ··· 3148 3147 param.regd = hwsim_world_regdom_custom[idx]; 3149 3148 } 3150 3149 3151 - return mac80211_hwsim_new_radio(info, &param); 3150 + ret = mac80211_hwsim_new_radio(info, &param); 3151 + kfree(hwname); 3152 + return ret; 3152 3153 } 3153 3154 3154 3155 static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
+1 -1
include/net/tcp.h
··· 539 539 void tcp_send_ack(struct sock *sk); 540 540 void tcp_send_delayed_ack(struct sock *sk); 541 541 void tcp_send_loss_probe(struct sock *sk); 542 - bool tcp_schedule_loss_probe(struct sock *sk); 542 + bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto); 543 543 void tcp_skb_collapse_tstamp(struct sk_buff *skb, 544 544 const struct sk_buff *next_skb); 545 545
+1 -1
net/ipv4/tcp_input.c
··· 2964 2964 /* Try to schedule a loss probe; if that doesn't work, then schedule an RTO. */ 2965 2965 static void tcp_set_xmit_timer(struct sock *sk) 2966 2966 { 2967 - if (!tcp_schedule_loss_probe(sk)) 2967 + if (!tcp_schedule_loss_probe(sk, true)) 2968 2968 tcp_rearm_rto(sk); 2969 2969 } 2970 2970
+5 -3
net/ipv4/tcp_output.c
··· 2391 2391 2392 2392 /* Send one loss probe per tail loss episode. */ 2393 2393 if (push_one != 2) 2394 - tcp_schedule_loss_probe(sk); 2394 + tcp_schedule_loss_probe(sk, false); 2395 2395 is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd); 2396 2396 tcp_cwnd_validate(sk, is_cwnd_limited); 2397 2397 return false; ··· 2399 2399 return !tp->packets_out && !tcp_write_queue_empty(sk); 2400 2400 } 2401 2401 2402 - bool tcp_schedule_loss_probe(struct sock *sk) 2402 + bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto) 2403 2403 { 2404 2404 struct inet_connection_sock *icsk = inet_csk(sk); 2405 2405 struct tcp_sock *tp = tcp_sk(sk); ··· 2440 2440 } 2441 2441 2442 2442 /* If the RTO formula yields an earlier time, then use that time. */ 2443 - rto_delta_us = tcp_rto_delta_us(sk); /* How far in future is RTO? */ 2443 + rto_delta_us = advancing_rto ? 2444 + jiffies_to_usecs(inet_csk(sk)->icsk_rto) : 2445 + tcp_rto_delta_us(sk); /* How far in future is RTO? */ 2444 2446 if (rto_delta_us > 0) 2445 2447 timeout = min_t(u32, timeout, usecs_to_jiffies(rto_delta_us)); 2446 2448
+1 -1
net/ipv6/ip6_gre.c
··· 460 460 &ipv6h->saddr, &ipv6h->daddr, tpi->key, 461 461 tpi->proto); 462 462 if (tunnel) { 463 - ip6_tnl_rcv(tunnel, skb, tpi, NULL, false); 463 + ip6_tnl_rcv(tunnel, skb, tpi, NULL, log_ecn_error); 464 464 465 465 return PACKET_RCVD; 466 466 }
+17 -24
net/mac80211/agg-rx.c
··· 151 151 * After accepting the AddBA Request we activated a timer, 152 152 * resetting it after each frame that arrives from the originator. 153 153 */ 154 - static void sta_rx_agg_session_timer_expired(unsigned long data) 154 + static void sta_rx_agg_session_timer_expired(struct timer_list *t) 155 155 { 156 - /* not an elegant detour, but there is no choice as the timer passes 157 - * only one argument, and various sta_info are needed here, so init 158 - * flow in sta_info_create gives the TID as data, while the timer_to_id 159 - * array gives the sta through container_of */ 160 - u8 *ptid = (u8 *)data; 161 - u8 *timer_to_id = ptid - *ptid; 162 - struct sta_info *sta = container_of(timer_to_id, struct sta_info, 163 - timer_to_tid[0]); 156 + struct tid_ampdu_rx *tid_rx_timer = 157 + from_timer(tid_rx_timer, t, session_timer); 158 + struct sta_info *sta = tid_rx_timer->sta; 159 + u8 tid = tid_rx_timer->tid; 164 160 struct tid_ampdu_rx *tid_rx; 165 161 unsigned long timeout; 166 162 167 163 rcu_read_lock(); 168 - tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[*ptid]); 164 + tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); 169 165 if (!tid_rx) { 170 166 rcu_read_unlock(); 171 167 return; ··· 176 180 rcu_read_unlock(); 177 181 178 182 ht_dbg(sta->sdata, "RX session timer expired on %pM tid %d\n", 179 - sta->sta.addr, (u16)*ptid); 183 + sta->sta.addr, tid); 180 184 181 - set_bit(*ptid, sta->ampdu_mlme.tid_rx_timer_expired); 185 + set_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired); 182 186 ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work); 183 187 } 184 188 185 - static void sta_rx_agg_reorder_timer_expired(unsigned long data) 189 + static void sta_rx_agg_reorder_timer_expired(struct timer_list *t) 186 190 { 187 - u8 *ptid = (u8 *)data; 188 - u8 *timer_to_id = ptid - *ptid; 189 - struct sta_info *sta = container_of(timer_to_id, struct sta_info, 190 - timer_to_tid[0]); 191 + struct tid_ampdu_rx *tid_rx = from_timer(tid_rx, t, reorder_timer); 191 192 192 193 rcu_read_lock(); 193 - ieee80211_release_reorder_timeout(sta, *ptid); 194 + ieee80211_release_reorder_timeout(tid_rx->sta, tid_rx->tid); 194 195 rcu_read_unlock(); 195 196 } 196 197 ··· 349 356 spin_lock_init(&tid_agg_rx->reorder_lock); 350 357 351 358 /* rx timer */ 352 - setup_deferrable_timer(&tid_agg_rx->session_timer, 353 - sta_rx_agg_session_timer_expired, 354 - (unsigned long)&sta->timer_to_tid[tid]); 359 + timer_setup(&tid_agg_rx->session_timer, 360 + sta_rx_agg_session_timer_expired, TIMER_DEFERRABLE); 355 361 356 362 /* rx reorder timer */ 357 - setup_timer(&tid_agg_rx->reorder_timer, 358 - sta_rx_agg_reorder_timer_expired, 359 - (unsigned long)&sta->timer_to_tid[tid]); 363 + timer_setup(&tid_agg_rx->reorder_timer, 364 + sta_rx_agg_reorder_timer_expired, 0); 360 365 361 366 /* prepare reordering buffer */ 362 367 tid_agg_rx->reorder_buf = ··· 390 399 tid_agg_rx->auto_seq = auto_seq; 391 400 tid_agg_rx->started = false; 392 401 tid_agg_rx->reorder_buf_filtered = 0; 402 + tid_agg_rx->tid = tid; 403 + tid_agg_rx->sta = sta; 393 404 status = WLAN_STATUS_SUCCESS; 394 405 395 406 /* activate it for RX */
+23 -26
net/mac80211/agg-tx.c
··· 330 330 331 331 spin_lock_bh(&sta->lock); 332 332 333 + /* free struct pending for start, if present */ 334 + tid_tx = sta->ampdu_mlme.tid_start_tx[tid]; 335 + kfree(tid_tx); 336 + sta->ampdu_mlme.tid_start_tx[tid] = NULL; 337 + 333 338 tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 334 339 if (!tid_tx) { 335 340 spin_unlock_bh(&sta->lock); ··· 427 422 * add Block Ack response will arrive from the recipient. 428 423 * If this timer expires sta_addba_resp_timer_expired will be executed. 429 424 */ 430 - static void sta_addba_resp_timer_expired(unsigned long data) 425 + static void sta_addba_resp_timer_expired(struct timer_list *t) 431 426 { 432 - /* not an elegant detour, but there is no choice as the timer passes 433 - * only one argument, and both sta_info and TID are needed, so init 434 - * flow in sta_info_create gives the TID as data, while the timer_to_id 435 - * array gives the sta through container_of */ 436 - u16 tid = *(u8 *)data; 437 - struct sta_info *sta = container_of((void *)data, 438 - struct sta_info, timer_to_tid[tid]); 427 + struct tid_ampdu_tx *tid_tx_timer = 428 + from_timer(tid_tx_timer, t, addba_resp_timer); 429 + struct sta_info *sta = tid_tx_timer->sta; 430 + u8 tid = tid_tx_timer->tid; 439 431 struct tid_ampdu_tx *tid_tx; 440 432 441 433 /* check if the TID waits for addBA response */ ··· 527 525 * After accepting the AddBA Response we activated a timer, 528 526 * resetting it after each frame that we send. 529 527 */ 530 - static void sta_tx_agg_session_timer_expired(unsigned long data) 528 + static void sta_tx_agg_session_timer_expired(struct timer_list *t) 531 529 { 532 - /* not an elegant detour, but there is no choice as the timer passes 533 - * only one argument, and various sta_info are needed here, so init 534 - * flow in sta_info_create gives the TID as data, while the timer_to_id 535 - * array gives the sta through container_of */ 536 - u8 *ptid = (u8 *)data; 537 - u8 *timer_to_id = ptid - *ptid; 538 - struct sta_info *sta = container_of(timer_to_id, struct sta_info, 539 - timer_to_tid[0]); 530 + struct tid_ampdu_tx *tid_tx_timer = 531 + from_timer(tid_tx_timer, t, session_timer); 532 + struct sta_info *sta = tid_tx_timer->sta; 533 + u8 tid = tid_tx_timer->tid; 540 534 struct tid_ampdu_tx *tid_tx; 541 535 unsigned long timeout; 542 536 543 537 rcu_read_lock(); 544 - tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[*ptid]); 538 + tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); 545 539 if (!tid_tx || test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { 546 540 rcu_read_unlock(); 547 541 return; ··· 553 555 rcu_read_unlock(); 554 556 555 557 ht_dbg(sta->sdata, "tx session timer expired on %pM tid %d\n", 556 - sta->sta.addr, (u16)*ptid); 558 + sta->sta.addr, tid); 557 559 558 - ieee80211_stop_tx_ba_session(&sta->sta, *ptid); 560 + ieee80211_stop_tx_ba_session(&sta->sta, tid); 559 561 } 560 562 561 563 int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, ··· 668 670 __set_bit(HT_AGG_STATE_WANT_START, &tid_tx->state); 669 671 670 672 tid_tx->timeout = timeout; 673 + tid_tx->sta = sta; 674 + tid_tx->tid = tid; 671 675 672 676 /* response timer */ 673 - setup_timer(&tid_tx->addba_resp_timer, 674 - sta_addba_resp_timer_expired, 675 - (unsigned long)&sta->timer_to_tid[tid]); 677 + timer_setup(&tid_tx->addba_resp_timer, sta_addba_resp_timer_expired, 0); 676 678 677 679 /* tx timer */ 678 - setup_deferrable_timer(&tid_tx->session_timer, 679 - sta_tx_agg_session_timer_expired, 680 - (unsigned long)&sta->timer_to_tid[tid]); 680 + timer_setup(&tid_tx->session_timer, 681 + sta_tx_agg_session_timer_expired, TIMER_DEFERRABLE); 681 682 682 683 /* assign a dialog token */ 683 684 sta->ampdu_mlme.dialog_token_allocator++;
+3 -4
net/mac80211/ibss.c
··· 1711 1711 sdata_unlock(sdata); 1712 1712 } 1713 1713 1714 - static void ieee80211_ibss_timer(unsigned long data) 1714 + static void ieee80211_ibss_timer(struct timer_list *t) 1715 1715 { 1716 1716 struct ieee80211_sub_if_data *sdata = 1717 - (struct ieee80211_sub_if_data *) data; 1717 + from_timer(sdata, t, u.ibss.timer); 1718 1718 1719 1719 ieee80211_queue_work(&sdata->local->hw, &sdata->work); 1720 1720 } ··· 1723 1723 { 1724 1724 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; 1725 1725 1726 - setup_timer(&ifibss->timer, ieee80211_ibss_timer, 1727 - (unsigned long) sdata); 1726 + timer_setup(&ifibss->timer, ieee80211_ibss_timer, 0); 1728 1727 INIT_LIST_HEAD(&ifibss->incomplete_stations); 1729 1728 spin_lock_init(&ifibss->incomplete_lock); 1730 1729 INIT_WORK(&ifibss->csa_connection_drop_work,
+2 -1
net/mac80211/ieee80211_i.h
··· 1057 1057 const struct ieee80211_tpt_blink *blink_table; 1058 1058 unsigned int blink_table_len; 1059 1059 struct timer_list timer; 1060 + struct ieee80211_local *local; 1060 1061 unsigned long prev_traffic; 1061 1062 unsigned long tx_bytes, rx_bytes; 1062 1063 unsigned int active, want; ··· 1933 1932 1934 1933 void ieee80211_dynamic_ps_enable_work(struct work_struct *work); 1935 1934 void ieee80211_dynamic_ps_disable_work(struct work_struct *work); 1936 - void ieee80211_dynamic_ps_timer(unsigned long data); 1935 + void ieee80211_dynamic_ps_timer(struct timer_list *t); 1937 1936 void ieee80211_send_nullfunc(struct ieee80211_local *local, 1938 1937 struct ieee80211_sub_if_data *sdata, 1939 1938 bool powersave);
+6 -5
net/mac80211/led.c
··· 248 248 return DIV_ROUND_UP(delta, 1024 / 8); 249 249 } 250 250 251 - static void tpt_trig_timer(unsigned long data) 251 + static void tpt_trig_timer(struct timer_list *t) 252 252 { 253 - struct ieee80211_local *local = (void *)data; 254 - struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; 253 + struct tpt_led_trigger *tpt_trig = from_timer(tpt_trig, t, timer); 254 + struct ieee80211_local *local = tpt_trig->local; 255 255 struct led_classdev *led_cdev; 256 256 unsigned long on, off, tpt; 257 257 int i; ··· 306 306 tpt_trig->blink_table = blink_table; 307 307 tpt_trig->blink_table_len = blink_table_len; 308 308 tpt_trig->want = flags; 309 + tpt_trig->local = local; 309 310 310 - setup_timer(&tpt_trig->timer, tpt_trig_timer, (unsigned long)local); 311 + timer_setup(&tpt_trig->timer, tpt_trig_timer, 0); 311 312 312 313 local->tpt_led_trigger = tpt_trig; 313 314 ··· 327 326 tpt_trig_traffic(local, tpt_trig); 328 327 tpt_trig->running = true; 329 328 330 - tpt_trig_timer((unsigned long)local); 329 + tpt_trig_timer(&tpt_trig->timer); 331 330 mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ)); 332 331 } 333 332
+1 -2
net/mac80211/main.c
··· 633 633 ieee80211_dynamic_ps_enable_work); 634 634 INIT_WORK(&local->dynamic_ps_disable_work, 635 635 ieee80211_dynamic_ps_disable_work); 636 - setup_timer(&local->dynamic_ps_timer, 637 - ieee80211_dynamic_ps_timer, (unsigned long) local); 636 + timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0); 638 637 639 638 INIT_WORK(&local->sched_scan_stopped_work, 640 639 ieee80211_sched_scan_stopped_work);
+12 -15
net/mac80211/mesh.c
··· 37 37 kmem_cache_destroy(rm_cache); 38 38 } 39 39 40 - static void ieee80211_mesh_housekeeping_timer(unsigned long data) 40 + static void ieee80211_mesh_housekeeping_timer(struct timer_list *t) 41 41 { 42 - struct ieee80211_sub_if_data *sdata = (void *) data; 42 + struct ieee80211_sub_if_data *sdata = 43 + from_timer(sdata, t, u.mesh.housekeeping_timer); 43 44 struct ieee80211_local *local = sdata->local; 44 45 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 45 46 ··· 529 528 return 0; 530 529 } 531 530 532 - static void ieee80211_mesh_path_timer(unsigned long data) 531 + static void ieee80211_mesh_path_timer(struct timer_list *t) 533 532 { 534 533 struct ieee80211_sub_if_data *sdata = 535 - (struct ieee80211_sub_if_data *) data; 534 + from_timer(sdata, t, u.mesh.mesh_path_timer); 536 535 537 536 ieee80211_queue_work(&sdata->local->hw, &sdata->work); 538 537 } 539 538 540 - static void ieee80211_mesh_path_root_timer(unsigned long data) 539 + static void ieee80211_mesh_path_root_timer(struct timer_list *t) 541 540 { 542 541 struct ieee80211_sub_if_data *sdata = 543 - (struct ieee80211_sub_if_data *) data; 542 + from_timer(sdata, t, u.mesh.mesh_path_root_timer); 544 543 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 545 544 546 545 set_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags); ··· 1443 1442 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 1444 1443 static u8 zero_addr[ETH_ALEN] = {}; 1445 1444 1446 - setup_timer(&ifmsh->housekeeping_timer, 1447 - ieee80211_mesh_housekeeping_timer, 1448 - (unsigned long) sdata); 1445 + timer_setup(&ifmsh->housekeeping_timer, 1446 + ieee80211_mesh_housekeeping_timer, 0); 1449 1447 1450 1448 ifmsh->accepting_plinks = true; 1451 1449 atomic_set(&ifmsh->mpaths, 0); ··· 1458 1458 1459 1459 mesh_pathtbl_init(sdata); 1460 1460 1461 - setup_timer(&ifmsh->mesh_path_timer, 1462 - ieee80211_mesh_path_timer, 1463 - (unsigned long) sdata); 1464 - setup_timer(&ifmsh->mesh_path_root_timer, 1465 - ieee80211_mesh_path_root_timer, 1466 - (unsigned long) sdata); 1461 + timer_setup(&ifmsh->mesh_path_timer, ieee80211_mesh_path_timer, 0); 1462 + timer_setup(&ifmsh->mesh_path_root_timer, 1463 + ieee80211_mesh_path_root_timer, 0); 1467 1464 INIT_LIST_HEAD(&ifmsh->preq_queue.list); 1468 1465 skb_queue_head_init(&ifmsh->ps.bc_buf); 1469 1466 spin_lock_init(&ifmsh->mesh_preq_queue_lock);
+1 -1
net/mac80211/mesh.h
··· 296 296 int mesh_pathtbl_init(struct ieee80211_sub_if_data *sdata); 297 297 void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata); 298 298 int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr); 299 - void mesh_path_timer(unsigned long data); 299 + void mesh_path_timer(struct timer_list *t); 300 300 void mesh_path_flush_by_nexthop(struct sta_info *sta); 301 301 void mesh_path_discard_frame(struct ieee80211_sub_if_data *sdata, 302 302 struct sk_buff *skb);
+2 -2
net/mac80211/mesh_hwmp.c
··· 1194 1194 return err; 1195 1195 } 1196 1196 1197 - void mesh_path_timer(unsigned long data) 1197 + void mesh_path_timer(struct timer_list *t) 1198 1198 { 1199 - struct mesh_path *mpath = (void *) data; 1199 + struct mesh_path *mpath = from_timer(mpath, t, timer); 1200 1200 struct ieee80211_sub_if_data *sdata = mpath->sdata; 1201 1201 int ret; 1202 1202
+1 -2
net/mac80211/mesh_pathtbl.c
··· 399 399 skb_queue_head_init(&new_mpath->frame_queue); 400 400 new_mpath->exp_time = jiffies; 401 401 spin_lock_init(&new_mpath->state_lock); 402 - setup_timer(&new_mpath->timer, mesh_path_timer, 403 - (unsigned long) new_mpath); 402 + timer_setup(&new_mpath->timer, mesh_path_timer, 0); 404 403 405 404 return new_mpath; 406 405 }
+14 -18
net/mac80211/mlme.c
··· 1066 1066 } 1067 1067 EXPORT_SYMBOL(ieee80211_chswitch_done); 1068 1068 1069 - static void ieee80211_chswitch_timer(unsigned long data) 1069 + static void ieee80211_chswitch_timer(struct timer_list *t) 1070 1070 { 1071 1071 struct ieee80211_sub_if_data *sdata = 1072 - (struct ieee80211_sub_if_data *) data; 1072 + from_timer(sdata, t, u.mgd.chswitch_timer); 1073 1073 1074 1074 ieee80211_queue_work(&sdata->local->hw, &sdata->u.mgd.chswitch_work); 1075 1075 } ··· 1577 1577 } 1578 1578 } 1579 1579 1580 - void ieee80211_dynamic_ps_timer(unsigned long data) 1580 + void ieee80211_dynamic_ps_timer(struct timer_list *t) 1581 1581 { 1582 - struct ieee80211_local *local = (void *) data; 1582 + struct ieee80211_local *local = from_timer(local, t, dynamic_ps_timer); 1583 1583 1584 1584 ieee80211_queue_work(&local->hw, &local->dynamic_ps_enable_work); 1585 1585 } ··· 3711 3711 sdata_unlock(sdata); 3712 3712 } 3713 3713 3714 - static void ieee80211_sta_timer(unsigned long data) 3714 + static void ieee80211_sta_timer(struct timer_list *t) 3715 3715 { 3716 3716 struct ieee80211_sub_if_data *sdata = 3717 - (struct ieee80211_sub_if_data *) data; 3717 + from_timer(sdata, t, u.mgd.timer); 3718 3718 3719 3719 ieee80211_queue_work(&sdata->local->hw, &sdata->work); 3720 3720 } ··· 3991 3991 sdata_unlock(sdata); 3992 3992 } 3993 3993 3994 - static void ieee80211_sta_bcn_mon_timer(unsigned long data) 3994 + static void ieee80211_sta_bcn_mon_timer(struct timer_list *t) 3995 3995 { 3996 3996 struct ieee80211_sub_if_data *sdata = 3997 - (struct ieee80211_sub_if_data *) data; 3997 + from_timer(sdata, t, u.mgd.bcn_mon_timer); 3998 3998 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 3999 3999 4000 4000 if (sdata->vif.csa_active && !ifmgd->csa_waiting_bcn) ··· 4005 4005 &sdata->u.mgd.beacon_connection_loss_work); 4006 4006 } 4007 4007 4008 - static void ieee80211_sta_conn_mon_timer(unsigned long data) 4008 + static void ieee80211_sta_conn_mon_timer(struct timer_list *t) 4009 4009 { 4010 4010 struct ieee80211_sub_if_data *sdata = 4011 - (struct ieee80211_sub_if_data *) data; 4011 + from_timer(sdata, t, u.mgd.conn_mon_timer); 4012 4012 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 4013 4013 struct ieee80211_local *local = sdata->local; 4014 4014 ··· 4139 4139 INIT_WORK(&ifmgd->request_smps_work, ieee80211_request_smps_mgd_work); 4140 4140 INIT_DELAYED_WORK(&ifmgd->tdls_peer_del_work, 4141 4141 ieee80211_tdls_peer_del_work); 4142 - setup_timer(&ifmgd->timer, ieee80211_sta_timer, 4143 - (unsigned long) sdata); 4144 - setup_timer(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer, 4145 - (unsigned long) sdata); 4146 - setup_timer(&ifmgd->conn_mon_timer, ieee80211_sta_conn_mon_timer, 4147 - (unsigned long) sdata); 4148 - setup_timer(&ifmgd->chswitch_timer, ieee80211_chswitch_timer, 4149 - (unsigned long) sdata); 4142 + timer_setup(&ifmgd->timer, ieee80211_sta_timer, 0); 4143 + timer_setup(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer, 0); 4144 + timer_setup(&ifmgd->conn_mon_timer, ieee80211_sta_conn_mon_timer, 0); 4145 + timer_setup(&ifmgd->chswitch_timer, ieee80211_chswitch_timer, 0); 4150 4146 INIT_DELAYED_WORK(&ifmgd->tx_tspec_wk, 4151 4147 ieee80211_sta_handle_tspec_ac_params_wk); 4152 4148
+5 -5
net/mac80211/ocb.c
··· 150 150 sdata_unlock(sdata); 151 151 } 152 152 153 - static void ieee80211_ocb_housekeeping_timer(unsigned long data) 153 + static void ieee80211_ocb_housekeeping_timer(struct timer_list *t) 154 154 { 155 - struct ieee80211_sub_if_data *sdata = (void *)data; 155 + struct ieee80211_sub_if_data *sdata = 156 + from_timer(sdata, t, u.ocb.housekeeping_timer); 156 157 struct ieee80211_local *local = sdata->local; 157 158 struct ieee80211_if_ocb *ifocb = &sdata->u.ocb; 158 159 ··· 166 165 { 167 166 struct ieee80211_if_ocb *ifocb = &sdata->u.ocb; 168 167 169 - setup_timer(&ifocb->housekeeping_timer, 170 - ieee80211_ocb_housekeeping_timer, 171 - (unsigned long)sdata); 168 + timer_setup(&ifocb->housekeeping_timer, 169 + ieee80211_ocb_housekeeping_timer, 0); 172 170 INIT_LIST_HEAD(&ifocb->incomplete_stations); 173 171 spin_lock_init(&ifocb->incomplete_lock); 174 172 }
+3 -12
net/mac80211/sta_info.c
··· 379 379 if (sta_prepare_rate_control(local, sta, gfp)) 380 380 goto free_txq; 381 381 382 - for (i = 0; i < IEEE80211_NUM_TIDS; i++) { 383 - /* 384 - * timer_to_tid must be initialized with identity mapping 385 - * to enable session_timer's data differentiation. See 386 - * sta_rx_agg_session_timer_expired for usage. 387 - */ 388 - sta->timer_to_tid[i] = i; 389 - } 390 382 for (i = 0; i < IEEE80211_NUM_ACS; i++) { 391 383 skb_queue_head_init(&sta->ps_tx_buf[i]); 392 384 skb_queue_head_init(&sta->tx_filtered[i]); ··· 1056 1064 return ret; 1057 1065 } 1058 1066 1059 - static void sta_info_cleanup(unsigned long data) 1067 + static void sta_info_cleanup(struct timer_list *t) 1060 1068 { 1061 - struct ieee80211_local *local = (struct ieee80211_local *) data; 1069 + struct ieee80211_local *local = from_timer(local, t, sta_cleanup); 1062 1070 struct sta_info *sta; 1063 1071 bool timer_needed = false; 1064 1072 ··· 1090 1098 mutex_init(&local->sta_mtx); 1091 1099 INIT_LIST_HEAD(&local->sta_list); 1092 1100 1093 - setup_timer(&local->sta_cleanup, sta_info_cleanup, 1094 - (unsigned long)local); 1101 + timer_setup(&local->sta_cleanup, sta_info_cleanup, 0); 1095 1102 return 0; 1096 1103 } 1097 1104
+10 -2
net/mac80211/sta_info.h
··· 126 126 AGG_STOP_DESTROY_STA, 127 127 }; 128 128 129 + struct sta_info; 130 + 129 131 /** 130 132 * struct tid_ampdu_tx - TID aggregation information (Tx). 131 133 * ··· 135 133 * @session_timer: check if we keep Tx-ing on the TID (by timeout value) 136 134 * @addba_resp_timer: timer for peer's response to addba request 137 135 * @pending: pending frames queue -- use sta's spinlock to protect 136 + * @sta: station we are attached to 138 137 * @dialog_token: dialog token for aggregation session 139 138 * @timeout: session timeout value to be filled in ADDBA requests 139 + * @tid: TID number 140 140 * @state: session state (see above) 141 141 * @last_tx: jiffies of last tx activity 142 142 * @stop_initiator: initiator of a session stop ··· 162 158 struct timer_list session_timer; 163 159 struct timer_list addba_resp_timer; 164 160 struct sk_buff_head pending; 161 + struct sta_info *sta; 165 162 unsigned long state; 166 163 unsigned long last_tx; 167 164 u16 timeout; ··· 174 169 u16 failed_bar_ssn; 175 170 bool bar_pending; 176 171 bool amsdu; 172 + u8 tid; 177 173 }; 178 174 179 175 /** ··· 187 181 * @reorder_time: jiffies when skb was added 188 182 * @session_timer: check if peer keeps Tx-ing on the TID (by timeout value) 189 183 * @reorder_timer: releases expired frames from the reorder buffer. 184 + * @sta: station we are attached to 190 185 * @last_rx: jiffies of last rx activity 191 186 * @head_seq_num: head sequence number in reordering buffer. 192 187 * @stored_mpdu_num: number of MPDUs in reordering buffer 193 188 * @ssn: Starting Sequence Number expected to be aggregated. 194 189 * @buf_size: buffer size for incoming A-MPDUs 195 190 * @timeout: reset timer value (in TUs). 191 + * @tid: TID number 196 192 * @rcu_head: RCU head used for freeing this struct 197 193 * @reorder_lock: serializes access to reorder buffer, see below. 198 194 * @auto_seq: used for offloaded BA sessions to automatically pick head_seq_and ··· 216 208 u64 reorder_buf_filtered; 217 209 struct sk_buff_head *reorder_buf; 218 210 unsigned long *reorder_time; 211 + struct sta_info *sta; 219 212 struct timer_list session_timer; 220 213 struct timer_list reorder_timer; 221 214 unsigned long last_rx; ··· 225 216 u16 ssn; 226 217 u16 buf_size; 227 218 u16 timeout; 219 + u8 tid; 228 220 u8 auto_seq:1, 229 221 removed:1, 230 222 started:1; ··· 457 447 * plus one for non-QoS frames) 458 448 * @tid_seq: per-TID sequence numbers for sending to this STA 459 449 * @ampdu_mlme: A-MPDU state machine state 460 - * @timer_to_tid: identity mapping to ID timers 461 450 * @mesh: mesh STA information 462 451 * @debugfs_dir: debug filesystem directory dentry 463 452 * @dead: set to true when sta is unlinked ··· 563 554 * Aggregation information, locked with lock. 564 555 */ 565 556 struct sta_ampdu_mlme ampdu_mlme; 566 - u8 timer_to_tid[IEEE80211_NUM_TIDS]; 567 557 568 558 #ifdef CONFIG_MAC80211_DEBUGFS 569 559 struct dentry *debugfs_dir;
+1 -1
net/tipc/group.c
··· 539 539 tipc_group_proto_xmit(grp, m, GRP_ACK_MSG, xmitq); 540 540 541 541 if (leave) { 542 - tipc_group_delete_member(grp, m); 543 542 __skb_queue_purge(defq); 543 + tipc_group_delete_member(grp, m); 544 544 break; 545 545 } 546 546 if (!update)
+24 -2
net/wireless/nl80211.c
··· 2605 2605 goto nla_put_failure; 2606 2606 } 2607 2607 2608 - if (wdev->ssid_len) { 2609 - if (nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid)) 2608 + wdev_lock(wdev); 2609 + switch (wdev->iftype) { 2610 + case NL80211_IFTYPE_AP: 2611 + if (wdev->ssid_len && 2612 + nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid)) 2610 2613 goto nla_put_failure; 2614 + break; 2615 + case NL80211_IFTYPE_STATION: 2616 + case NL80211_IFTYPE_P2P_CLIENT: 2617 + case NL80211_IFTYPE_ADHOC: { 2618 + const u8 *ssid_ie; 2619 + if (!wdev->current_bss) 2620 + break; 2621 + ssid_ie = ieee80211_bss_get_ie(&wdev->current_bss->pub, 2622 + WLAN_EID_SSID); 2623 + if (!ssid_ie) 2624 + break; 2625 + if (nla_put(msg, NL80211_ATTR_SSID, ssid_ie[1], ssid_ie + 2)) 2626 + goto nla_put_failure; 2627 + break; 2628 + } 2629 + default: 2630 + /* nothing */ 2631 + break; 2611 2632 } 2633 + wdev_unlock(wdev); 2612 2634 2613 2635 genlmsg_end(msg, hdr); 2614 2636 return 0;
+27 -15
net/wireless/reg.c
··· 3644 3644 } 3645 3645 } 3646 3646 3647 - int __init regulatory_init(void) 3647 + static int __init regulatory_init_db(void) 3648 3648 { 3649 - int err = 0; 3649 + int err; 3650 3650 3651 3651 err = load_builtin_regdb_keys(); 3652 3652 if (err) 3653 3653 return err; 3654 - 3655 - reg_pdev = platform_device_register_simple("regulatory", 0, NULL, 0); 3656 - if (IS_ERR(reg_pdev)) 3657 - return PTR_ERR(reg_pdev); 3658 - 3659 - spin_lock_init(&reg_requests_lock); 3660 - spin_lock_init(&reg_pending_beacons_lock); 3661 - spin_lock_init(&reg_indoor_lock); 3662 - 3663 - rcu_assign_pointer(cfg80211_regdomain, cfg80211_world_regdom); 3664 - 3665 - user_alpha2[0] = '9'; 3666 - user_alpha2[1] = '7'; 3667 3654 3668 3655 /* We always try to get an update for the static regdomain */ 3669 3656 err = regulatory_hint_core(cfg80211_world_regdom->alpha2); ··· 3678 3691 NL80211_USER_REG_HINT_USER); 3679 3692 3680 3693 return 0; 3694 + } 3695 + #ifndef MODULE 3696 + late_initcall(regulatory_init_db); 3697 + #endif 3698 + 3699 + int __init regulatory_init(void) 3700 + { 3701 + reg_pdev = platform_device_register_simple("regulatory", 0, NULL, 0); 3702 + if (IS_ERR(reg_pdev)) 3703 + return PTR_ERR(reg_pdev); 3704 + 3705 + spin_lock_init(&reg_requests_lock); 3706 + spin_lock_init(&reg_pending_beacons_lock); 3707 + spin_lock_init(&reg_indoor_lock); 3708 + 3709 + rcu_assign_pointer(cfg80211_regdomain, cfg80211_world_regdom); 3710 + 3711 + user_alpha2[0] = '9'; 3712 + user_alpha2[1] = '7'; 3713 + 3714 + #ifdef MODULE 3715 + return regulatory_init_db(); 3716 + #else 3717 + return 0; 3718 + #endif 3681 3719 } 3682 3720 3683 3721 void regulatory_exit(void)