From 655ffee284dfcf9a24ac0343f3e5ee6db85b85c5 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Sat, 27 Feb 2010 07:35:45 +0000 Subject: wireless: convert to use netdev_for_each_mc_addr also added missed locking in rndis_wlan.c Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller --- drivers/net/wireless/rndis_wlan.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers/net/wireless/rndis_wlan.c') diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 65cbd060cc30..9f6d6bf06b8e 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c @@ -1502,6 +1502,7 @@ static void set_multicast_list(struct usbnet *usbdev) filter = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST; + netif_addr_lock_bh(usbdev->net); if (usbdev->net->flags & IFF_PROMISC) { filter |= RNDIS_PACKET_TYPE_PROMISCUOUS | RNDIS_PACKET_TYPE_ALL_LOCAL; @@ -1515,16 +1516,15 @@ static void set_multicast_list(struct usbnet *usbdev) netdev_warn(usbdev->net, "couldn't alloc %d bytes of memory\n", size * ETH_ALEN); + netif_addr_unlock_bh(usbdev->net); return; } - mclist = usbdev->net->mc_list; - for (i = 0; i < size && mclist; mclist = mclist->next) { - if (mclist->dmi_addrlen != ETH_ALEN) - continue; - - memcpy(buf + i * ETH_ALEN, mclist->dmi_addr, ETH_ALEN); - i++; + i = 0; + netdev_for_each_mc_addr(mclist, usbdev->net) { + if (i == size) + break; + memcpy(buf + i++ * ETH_ALEN, mclist->dmi_addr, ETH_ALEN); } ret = rndis_set_oid(usbdev, OID_802_3_MULTICAST_LIST, buf, @@ -1539,6 +1539,7 @@ static void set_multicast_list(struct usbnet *usbdev) kfree(buf); } + netif_addr_unlock_bh(usbdev->net); ret = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter, sizeof(filter)); -- cgit v1.2.1