diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-05-05 21:33:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-16 02:48:02 -0400 |
commit | a14462f1bd4d3962994f518459102000438665aa (patch) | |
tree | 309eda1cd2698a5224713e43173edbd640f4487f /drivers/net/macvlan.c | |
parent | 10fc51b9953112ade61e33ff2f6f005f005a2361 (diff) |
net: adjust handle_macvlan to pass port struct to hook
Now there's null check here and also again in the hook. Looking at bridge bits
which are simmilar, port structure is rcu_dereferenced right away in
handle_bridge and passed to hook. Looks nicer.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r-- | drivers/net/macvlan.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 9a939d828b47..1b78c0057a8d 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -145,19 +145,15 @@ static void macvlan_broadcast(struct sk_buff *skb, | |||
145 | } | 145 | } |
146 | 146 | ||
147 | /* called under rcu_read_lock() from netif_receive_skb */ | 147 | /* called under rcu_read_lock() from netif_receive_skb */ |
148 | static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb) | 148 | static struct sk_buff *macvlan_handle_frame(struct macvlan_port *port, |
149 | struct sk_buff *skb) | ||
149 | { | 150 | { |
150 | const struct ethhdr *eth = eth_hdr(skb); | 151 | const struct ethhdr *eth = eth_hdr(skb); |
151 | const struct macvlan_port *port; | ||
152 | const struct macvlan_dev *vlan; | 152 | const struct macvlan_dev *vlan; |
153 | const struct macvlan_dev *src; | 153 | const struct macvlan_dev *src; |
154 | struct net_device *dev; | 154 | struct net_device *dev; |
155 | unsigned int len; | 155 | unsigned int len; |
156 | 156 | ||
157 | port = rcu_dereference(skb->dev->macvlan_port); | ||
158 | if (port == NULL) | ||
159 | return skb; | ||
160 | |||
161 | if (is_multicast_ether_addr(eth->h_dest)) { | 157 | if (is_multicast_ether_addr(eth->h_dest)) { |
162 | src = macvlan_hash_lookup(port, eth->h_source); | 158 | src = macvlan_hash_lookup(port, eth->h_source); |
163 | if (!src) | 159 | if (!src) |