diff options
author | stephen hemminger <shemminger@vyatta.com> | 2010-07-27 04:26:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-28 13:50:55 -0400 |
commit | eeaf61d8891f9c9ed12c1a667e72bf83f0857954 (patch) | |
tree | daeda447800df1349559268d8f6e79c90dcd22dd /net/bridge | |
parent | ff847ac2d3e90edd94674c28bade25ae1e6a2e49 (diff) |
bridge: add rcu_read_lock on transmit
Long ago, when bridge was converted to RCU, rcu lock was equivalent
to having preempt disabled. RCU has changed a lot since then and
bridge code was still assuming the since transmit was called with
bottom half disabled, it was RCU safe.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Tested-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_device.c | 4 | ||||
-rw-r--r-- | net/bridge/br_fdb.c | 2 | ||||
-rw-r--r-- | net/bridge/br_input.c | 6 | ||||
-rw-r--r-- | net/bridge/br_stp_bpdu.c | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 753fc4221f3c..4cec8051164d 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
23 | #include "br_private.h" | 23 | #include "br_private.h" |
24 | 24 | ||
25 | /* net device transmit always called with no BH (preempt_disabled) */ | 25 | /* net device transmit always called with BH disabled */ |
26 | netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) | 26 | netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) |
27 | { | 27 | { |
28 | struct net_bridge *br = netdev_priv(dev); | 28 | struct net_bridge *br = netdev_priv(dev); |
@@ -46,6 +46,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
46 | skb_reset_mac_header(skb); | 46 | skb_reset_mac_header(skb); |
47 | skb_pull(skb, ETH_HLEN); | 47 | skb_pull(skb, ETH_HLEN); |
48 | 48 | ||
49 | rcu_read_lock(); | ||
49 | if (is_multicast_ether_addr(dest)) { | 50 | if (is_multicast_ether_addr(dest)) { |
50 | if (br_multicast_rcv(br, NULL, skb)) | 51 | if (br_multicast_rcv(br, NULL, skb)) |
51 | goto out; | 52 | goto out; |
@@ -61,6 +62,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
61 | br_flood_deliver(br, skb); | 62 | br_flood_deliver(br, skb); |
62 | 63 | ||
63 | out: | 64 | out: |
65 | rcu_read_unlock(); | ||
64 | return NETDEV_TX_OK; | 66 | return NETDEV_TX_OK; |
65 | } | 67 | } |
66 | 68 | ||
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index b01dde35a69e..7204ad3aff65 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c | |||
@@ -214,7 +214,7 @@ void br_fdb_delete_by_port(struct net_bridge *br, | |||
214 | spin_unlock_bh(&br->hash_lock); | 214 | spin_unlock_bh(&br->hash_lock); |
215 | } | 215 | } |
216 | 216 | ||
217 | /* No locking or refcounting, assumes caller has no preempt (rcu_read_lock) */ | 217 | /* No locking or refcounting, assumes caller has rcu_read_lock */ |
218 | struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br, | 218 | struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br, |
219 | const unsigned char *addr) | 219 | const unsigned char *addr) |
220 | { | 220 | { |
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index d36e700f7a26..114365c9eb1c 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c | |||
@@ -37,7 +37,7 @@ static int br_pass_frame_up(struct sk_buff *skb) | |||
37 | netif_receive_skb); | 37 | netif_receive_skb); |
38 | } | 38 | } |
39 | 39 | ||
40 | /* note: already called with rcu_read_lock (preempt_disabled) */ | 40 | /* note: already called with rcu_read_lock */ |
41 | int br_handle_frame_finish(struct sk_buff *skb) | 41 | int br_handle_frame_finish(struct sk_buff *skb) |
42 | { | 42 | { |
43 | const unsigned char *dest = eth_hdr(skb)->h_dest; | 43 | const unsigned char *dest = eth_hdr(skb)->h_dest; |
@@ -108,7 +108,7 @@ drop: | |||
108 | goto out; | 108 | goto out; |
109 | } | 109 | } |
110 | 110 | ||
111 | /* note: already called with rcu_read_lock (preempt_disabled) */ | 111 | /* note: already called with rcu_read_lock */ |
112 | static int br_handle_local_finish(struct sk_buff *skb) | 112 | static int br_handle_local_finish(struct sk_buff *skb) |
113 | { | 113 | { |
114 | struct net_bridge_port *p = rcu_dereference(skb->dev->br_port); | 114 | struct net_bridge_port *p = rcu_dereference(skb->dev->br_port); |
@@ -133,7 +133,7 @@ static inline int is_link_local(const unsigned char *dest) | |||
133 | /* | 133 | /* |
134 | * Called via br_handle_frame_hook. | 134 | * Called via br_handle_frame_hook. |
135 | * Return NULL if skb is handled | 135 | * Return NULL if skb is handled |
136 | * note: already called with rcu_read_lock (preempt_disabled) | 136 | * note: already called with rcu_read_lock |
137 | */ | 137 | */ |
138 | struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb) | 138 | struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb) |
139 | { | 139 | { |
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c index 217bd225a42f..5854e8285a9c 100644 --- a/net/bridge/br_stp_bpdu.c +++ b/net/bridge/br_stp_bpdu.c | |||
@@ -131,7 +131,7 @@ void br_send_tcn_bpdu(struct net_bridge_port *p) | |||
131 | /* | 131 | /* |
132 | * Called from llc. | 132 | * Called from llc. |
133 | * | 133 | * |
134 | * NO locks, but rcu_read_lock (preempt_disabled) | 134 | * NO locks, but rcu_read_lock |
135 | */ | 135 | */ |
136 | void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb, | 136 | void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb, |
137 | struct net_device *dev) | 137 | struct net_device *dev) |