diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2006-07-10 19:21:29 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-07-12 16:58:40 -0400 |
commit | 95ff9f4d3cc72b62b76498290d00d129e1e62545 (patch) | |
tree | 05db2299df178da6eca5aef25dc18ece8f5053a3 /net | |
parent | e55ffac6011731c455856072cb23aa20bd55c367 (diff) |
[AX.25]: Fix locking of ax25 protocol function list.
Delivery of AX.25 frame to the layer 3 protocols happens in softirq
context so locking needs to be bh-proof.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ax25/ax25_iface.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c index 77ba07c67682..07ac0207eb69 100644 --- a/net/ax25/ax25_iface.c +++ b/net/ax25/ax25_iface.c | |||
@@ -66,10 +66,10 @@ int ax25_protocol_register(unsigned int pid, | |||
66 | protocol->pid = pid; | 66 | protocol->pid = pid; |
67 | protocol->func = func; | 67 | protocol->func = func; |
68 | 68 | ||
69 | write_lock(&protocol_list_lock); | 69 | write_lock_bh(&protocol_list_lock); |
70 | protocol->next = protocol_list; | 70 | protocol->next = protocol_list; |
71 | protocol_list = protocol; | 71 | protocol_list = protocol; |
72 | write_unlock(&protocol_list_lock); | 72 | write_unlock_bh(&protocol_list_lock); |
73 | 73 | ||
74 | return 1; | 74 | return 1; |
75 | } | 75 | } |
@@ -80,16 +80,16 @@ void ax25_protocol_release(unsigned int pid) | |||
80 | { | 80 | { |
81 | struct protocol_struct *s, *protocol; | 81 | struct protocol_struct *s, *protocol; |
82 | 82 | ||
83 | write_lock(&protocol_list_lock); | 83 | write_lock_bh(&protocol_list_lock); |
84 | protocol = protocol_list; | 84 | protocol = protocol_list; |
85 | if (protocol == NULL) { | 85 | if (protocol == NULL) { |
86 | write_unlock(&protocol_list_lock); | 86 | write_unlock_bh(&protocol_list_lock); |
87 | return; | 87 | return; |
88 | } | 88 | } |
89 | 89 | ||
90 | if (protocol->pid == pid) { | 90 | if (protocol->pid == pid) { |
91 | protocol_list = protocol->next; | 91 | protocol_list = protocol->next; |
92 | write_unlock(&protocol_list_lock); | 92 | write_unlock_bh(&protocol_list_lock); |
93 | kfree(protocol); | 93 | kfree(protocol); |
94 | return; | 94 | return; |
95 | } | 95 | } |
@@ -98,14 +98,14 @@ void ax25_protocol_release(unsigned int pid) | |||
98 | if (protocol->next->pid == pid) { | 98 | if (protocol->next->pid == pid) { |
99 | s = protocol->next; | 99 | s = protocol->next; |
100 | protocol->next = protocol->next->next; | 100 | protocol->next = protocol->next->next; |
101 | write_unlock(&protocol_list_lock); | 101 | write_unlock_bh(&protocol_list_lock); |
102 | kfree(s); | 102 | kfree(s); |
103 | return; | 103 | return; |
104 | } | 104 | } |
105 | 105 | ||
106 | protocol = protocol->next; | 106 | protocol = protocol->next; |
107 | } | 107 | } |
108 | write_unlock(&protocol_list_lock); | 108 | write_unlock_bh(&protocol_list_lock); |
109 | } | 109 | } |
110 | 110 | ||
111 | EXPORT_SYMBOL(ax25_protocol_release); | 111 | EXPORT_SYMBOL(ax25_protocol_release); |
@@ -266,13 +266,13 @@ int ax25_protocol_is_registered(unsigned int pid) | |||
266 | struct protocol_struct *protocol; | 266 | struct protocol_struct *protocol; |
267 | int res = 0; | 267 | int res = 0; |
268 | 268 | ||
269 | read_lock(&protocol_list_lock); | 269 | read_lock_bh(&protocol_list_lock); |
270 | for (protocol = protocol_list; protocol != NULL; protocol = protocol->next) | 270 | for (protocol = protocol_list; protocol != NULL; protocol = protocol->next) |
271 | if (protocol->pid == pid) { | 271 | if (protocol->pid == pid) { |
272 | res = 1; | 272 | res = 1; |
273 | break; | 273 | break; |
274 | } | 274 | } |
275 | read_unlock(&protocol_list_lock); | 275 | read_unlock_bh(&protocol_list_lock); |
276 | 276 | ||
277 | return res; | 277 | return res; |
278 | } | 278 | } |