diff options
author | Arve Hjønnevåg <arve@android.com> | 2010-06-17 15:23:59 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2010-09-29 17:49:37 -0700 |
commit | 56ab3d0a0037840bb67a20b2ffbd48b008540088 (patch) | |
tree | 71ba078018d2dae6abe408c98178780fe74c56c4 /drivers/net | |
parent | 1c57305e188cfce4017ddaa5a178184654f8755a (diff) |
network: wireless: bcm4329: Add 2.6.35 compatibility and fix memory leak in set_multicast_list
Signed-off-by: Dmitry Shmidt <dimitrysh@android.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/bcm4329/dhd_linux.c | 28 | ||||
-rw-r--r-- | drivers/net/wireless/bcm4329/include/linuxver.h | 1 |
2 files changed, 25 insertions, 4 deletions
diff --git a/drivers/net/wireless/bcm4329/dhd_linux.c b/drivers/net/wireless/bcm4329/dhd_linux.c index 9931870a6efd..da2cb640228d 100644 --- a/drivers/net/wireless/bcm4329/dhd_linux.c +++ b/drivers/net/wireless/bcm4329/dhd_linux.c @@ -707,7 +707,11 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) { struct net_device *dev; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + struct netdev_hw_addr *ha; +#else struct dev_mc_list *mclist; +#endif uint32 allmulti, cnt; wl_ioctl_t ioc; @@ -717,15 +721,19 @@ _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) ASSERT(dhd && dhd->iflist[ifidx]); dev = dhd->iflist[ifidx]->net; - mclist = dev->mc_list; + + netif_addr_lock_bh(dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + cnt = netdev_mc_count(dev); +#else cnt = dev->mc_count; +#endif + netif_addr_unlock_bh(dev); /* Determine initial value of allmulti flag */ allmulti = (dev->flags & IFF_ALLMULTI) ? TRUE : FALSE; /* Send down the multicast list first. */ - - buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETHER_ADDR_LEN); if (!(bufp = buf = MALLOC(dhd->pub.osh, buflen))) { DHD_ERROR(("%s: out of memory for mcast_list, cnt %d\n", @@ -740,10 +748,22 @@ _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) memcpy(bufp, &cnt, sizeof(cnt)); bufp += sizeof(cnt); - for (cnt = 0; mclist && (cnt < dev->mc_count); cnt++, mclist = mclist->next) { + netif_addr_lock_bh(dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) + netdev_for_each_mc_addr(ha, dev) { + if (!cnt) + break; + memcpy(bufp, ha->addr, ETHER_ADDR_LEN); + bufp += ETHER_ADDR_LEN; + cnt--; + } +#else + for (mclist = dev->mc_list;(mclist && (cnt > 0)); cnt--, mclist = mclist->next) { memcpy(bufp, (void *)mclist->dmi_addr, ETHER_ADDR_LEN); bufp += ETHER_ADDR_LEN; } +#endif + netif_addr_unlock_bh(dev); memset(&ioc, 0, sizeof(ioc)); ioc.cmd = WLC_SET_VAR; diff --git a/drivers/net/wireless/bcm4329/include/linuxver.h b/drivers/net/wireless/bcm4329/include/linuxver.h index 92848d735ac6..ab7566618da6 100644 --- a/drivers/net/wireless/bcm4329/include/linuxver.h +++ b/drivers/net/wireless/bcm4329/include/linuxver.h @@ -66,6 +66,7 @@ #include <linux/pci.h> #include <linux/interrupt.h> #include <linux/netdevice.h> +#include <linux/semaphore.h> #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) #undef IP_TOS #endif |