mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
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>
This commit is contained in:
committed by
Colin Cross
parent
1c57305e18
commit
56ab3d0a00
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user