net: ipv4: provide __rcu annotation for ifa_list
[linux-2.6-block.git] / drivers / net / vmxnet3 / vmxnet3_drv.c
index 89984fcab01e52a1a5e293183aa33e89db51b695..1b2a18ea855cbcd590bda8dda4f5b50b47972ee3 100644 (file)
@@ -3651,13 +3651,19 @@ vmxnet3_suspend(struct device *device)
        }
 
        if (adapter->wol & WAKE_ARP) {
-               in_dev = in_dev_get(netdev);
-               if (!in_dev)
+               rcu_read_lock();
+
+               in_dev = __in_dev_get_rcu(netdev);
+               if (!in_dev) {
+                       rcu_read_unlock();
                        goto skip_arp;
+               }
 
-               ifa = (struct in_ifaddr *)in_dev->ifa_list;
-               if (!ifa)
+               ifa = rcu_dereference(in_dev->ifa_list);
+               if (!ifa) {
+                       rcu_read_unlock();
                        goto skip_arp;
+               }
 
                pmConf->filters[i].patternSize = ETH_HLEN + /* Ethernet header*/
                        sizeof(struct arphdr) +         /* ARP header */
@@ -3677,7 +3683,9 @@ vmxnet3_suspend(struct device *device)
 
                /* The Unicast IPv4 address in 'tip' field. */
                arpreq += 2 * ETH_ALEN + sizeof(u32);
-               *(u32 *)arpreq = ifa->ifa_address;
+               *(__be32 *)arpreq = ifa->ifa_address;
+
+               rcu_read_unlock();
 
                /* The mask for the relevant bits. */
                pmConf->filters[i].mask[0] = 0x00;
@@ -3686,7 +3694,6 @@ vmxnet3_suspend(struct device *device)
                pmConf->filters[i].mask[3] = 0x00;
                pmConf->filters[i].mask[4] = 0xC0; /* IPv4 TIP */
                pmConf->filters[i].mask[5] = 0x03; /* IPv4 TIP */
-               in_dev_put(in_dev);
 
                pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_FILTER;
                i++;