[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>
This commit is contained in:
committed by
David S. Miller
parent
e55ffac601
commit
95ff9f4d3c
@@ -66,10 +66,10 @@ int ax25_protocol_register(unsigned int pid,
|
|||||||
protocol->pid = pid;
|
protocol->pid = pid;
|
||||||
protocol->func = func;
|
protocol->func = func;
|
||||||
|
|
||||||
write_lock(&protocol_list_lock);
|
write_lock_bh(&protocol_list_lock);
|
||||||
protocol->next = protocol_list;
|
protocol->next = protocol_list;
|
||||||
protocol_list = protocol;
|
protocol_list = protocol;
|
||||||
write_unlock(&protocol_list_lock);
|
write_unlock_bh(&protocol_list_lock);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -80,16 +80,16 @@ void ax25_protocol_release(unsigned int pid)
|
|||||||
{
|
{
|
||||||
struct protocol_struct *s, *protocol;
|
struct protocol_struct *s, *protocol;
|
||||||
|
|
||||||
write_lock(&protocol_list_lock);
|
write_lock_bh(&protocol_list_lock);
|
||||||
protocol = protocol_list;
|
protocol = protocol_list;
|
||||||
if (protocol == NULL) {
|
if (protocol == NULL) {
|
||||||
write_unlock(&protocol_list_lock);
|
write_unlock_bh(&protocol_list_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (protocol->pid == pid) {
|
if (protocol->pid == pid) {
|
||||||
protocol_list = protocol->next;
|
protocol_list = protocol->next;
|
||||||
write_unlock(&protocol_list_lock);
|
write_unlock_bh(&protocol_list_lock);
|
||||||
kfree(protocol);
|
kfree(protocol);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -98,14 +98,14 @@ void ax25_protocol_release(unsigned int pid)
|
|||||||
if (protocol->next->pid == pid) {
|
if (protocol->next->pid == pid) {
|
||||||
s = protocol->next;
|
s = protocol->next;
|
||||||
protocol->next = protocol->next->next;
|
protocol->next = protocol->next->next;
|
||||||
write_unlock(&protocol_list_lock);
|
write_unlock_bh(&protocol_list_lock);
|
||||||
kfree(s);
|
kfree(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
protocol = protocol->next;
|
protocol = protocol->next;
|
||||||
}
|
}
|
||||||
write_unlock(&protocol_list_lock);
|
write_unlock_bh(&protocol_list_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(ax25_protocol_release);
|
EXPORT_SYMBOL(ax25_protocol_release);
|
||||||
@@ -266,13 +266,13 @@ int ax25_protocol_is_registered(unsigned int pid)
|
|||||||
struct protocol_struct *protocol;
|
struct protocol_struct *protocol;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
read_lock(&protocol_list_lock);
|
read_lock_bh(&protocol_list_lock);
|
||||||
for (protocol = protocol_list; protocol != NULL; protocol = protocol->next)
|
for (protocol = protocol_list; protocol != NULL; protocol = protocol->next)
|
||||||
if (protocol->pid == pid) {
|
if (protocol->pid == pid) {
|
||||||
res = 1;
|
res = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
read_unlock(&protocol_list_lock);
|
read_unlock_bh(&protocol_list_lock);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user