source: branches/chaos_calmer/package/kernel/mac80211/patches/351-0043-brcmfmac-remove-worker-from-.ndo_set_mac_address-cal.patch @ 49407

Last change on this file since 49407 was 49407, checked in by rmilecki, 12 months ago

mac80211: brcmfmac: backport changes from 2016-09-27

This fixes memory leaks, some possible crashes and bug that could cause
WARNING on every add_key/del_key call. It also replaces WARNING with
a simple message. They may still occur e.g. on station going out of
range and A-MPDU stall in the firmware.

Signed-off-by: Rafał Miłecki <rafal@…>

File size: 3.9 KB
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c

    From 8fa5fdec09cd379c9ecb8972f344f8f308e0ccf3 Mon Sep 17 00:00:00 2001
    From: Arend Van Spriel <arend.vanspriel@broadcom.com>
    Date: Mon, 19 Sep 2016 12:09:55 +0100
    Subject: [PATCH] brcmfmac: remove worker from .ndo_set_mac_address() callback
    
    As it turns out there is no need to use a worker for the callback
    because it is not called from atomic context.
    
    Reported-by: Dan Williams <dcbw@redhat.com>
    Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
    Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
    Reviewed-by: Franky Lin <franky.lin@broadcom.com>
    Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    ---
     .../wireless/broadcom/brcm80211/brcmfmac/core.c    | 39 ++++++++--------------
     .../wireless/broadcom/brcm80211/brcmfmac/core.h    |  2 --
     2 files changed, 13 insertions(+), 28 deletions(-)
    
    a b static void _brcmf_set_multicast_list(st 
    136136                          err); 
    137137} 
    138138 
    139 static void 
    140 _brcmf_set_mac_address(struct work_struct *work) 
    141 { 
    142         struct brcmf_if *ifp; 
    143         s32 err; 
    144  
    145         ifp = container_of(work, struct brcmf_if, setmacaddr_work); 
    146  
    147         brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); 
    148  
    149         err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr, 
    150                                        ETH_ALEN); 
    151         if (err < 0) { 
    152                 brcmf_err("Setting cur_etheraddr failed, %d\n", err); 
    153         } else { 
    154                 brcmf_dbg(TRACE, "MAC address updated to %pM\n", 
    155                           ifp->mac_addr); 
    156                 memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN); 
    157         } 
    158 } 
    159  
    160139#if IS_ENABLED(CONFIG_IPV6) 
    161140static void _brcmf_update_ndtable(struct work_struct *work) 
    162141{ 
    static int brcmf_netdev_set_mac_address( 
    190169{ 
    191170        struct brcmf_if *ifp = netdev_priv(ndev); 
    192171        struct sockaddr *sa = (struct sockaddr *)addr; 
     172        int err; 
    193173 
    194         memcpy(&ifp->mac_addr, sa->sa_data, ETH_ALEN); 
    195         schedule_work(&ifp->setmacaddr_work); 
    196         return 0; 
     174        brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); 
     175 
     176        err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data, 
     177                                       ETH_ALEN); 
     178        if (err < 0) { 
     179                brcmf_err("Setting cur_etheraddr failed, %d\n", err); 
     180        } else { 
     181                brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data); 
     182                memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN); 
     183                memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN); 
     184        } 
     185        return err; 
    197186} 
    198187 
    199188static void brcmf_netdev_set_multicast_list(struct net_device *ndev) 
    int brcmf_net_attach(struct brcmf_if *if 
    525514        /* set the mac address */ 
    526515        memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); 
    527516 
    528         INIT_WORK(&ifp->setmacaddr_work, _brcmf_set_mac_address); 
    529517        INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list); 
    530518        INIT_WORK(&ifp->ndoffload_work, _brcmf_update_ndtable); 
    531519 
    static void brcmf_del_if(struct brcmf_pu 
    730718                } 
    731719 
    732720                if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) { 
    733                         cancel_work_sync(&ifp->setmacaddr_work); 
    734721                        cancel_work_sync(&ifp->multicast_work); 
    735722                        cancel_work_sync(&ifp->ndoffload_work); 
    736723                } 
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h

    a b enum brcmf_netif_stop_reason { 
    176176 * @vif: points to cfg80211 specific interface information. 
    177177 * @ndev: associated network device. 
    178178 * @stats: interface specific network statistics. 
    179  * @setmacaddr_work: worker object for setting mac address. 
    180179 * @multicast_work: worker object for multicast provisioning. 
    181180 * @ndoffload_work: worker object for neighbor discovery offload configuration. 
    182181 * @fws_desc: interface specific firmware-signalling descriptor. 
    struct brcmf_if { 
    193192        struct brcmf_cfg80211_vif *vif; 
    194193        struct net_device *ndev; 
    195194        struct net_device_stats stats; 
    196         struct work_struct setmacaddr_work; 
    197195        struct work_struct multicast_work; 
    198196        struct work_struct ndoffload_work; 
    199197        struct brcmf_fws_mac_descriptor *fws_desc; 
Note: See TracBrowser for help on using the repository browser.