Commit 62fcaee9 authored by Ralf Bächle's avatar Ralf Bächle

Replace interrupt-safe spinlocks with their bh-safe equivalents.

parent 9c81c0a2
...@@ -83,25 +83,24 @@ static void ax25_free_sock(struct sock *sk) ...@@ -83,25 +83,24 @@ static void ax25_free_sock(struct sock *sk)
static void ax25_remove_socket(ax25_cb *ax25) static void ax25_remove_socket(ax25_cb *ax25)
{ {
ax25_cb *s; ax25_cb *s;
unsigned long flags;
spin_lock_irqsave(&ax25_list_lock, flags); spin_lock_bh(&ax25_list_lock);
if ((s = ax25_list) == ax25) { if ((s = ax25_list) == ax25) {
ax25_list = s->next; ax25_list = s->next;
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
return; return;
} }
while (s != NULL && s->next != NULL) { while (s != NULL && s->next != NULL) {
if (s->next == ax25) { if (s->next == ax25) {
s->next = ax25->next; s->next = ax25->next;
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
return; return;
} }
s = s->next; s = s->next;
} }
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
} }
/* /*
...@@ -109,21 +108,20 @@ static void ax25_remove_socket(ax25_cb *ax25) ...@@ -109,21 +108,20 @@ static void ax25_remove_socket(ax25_cb *ax25)
*/ */
static void ax25_kill_by_device(struct net_device *dev) static void ax25_kill_by_device(struct net_device *dev)
{ {
unsigned long flags;
ax25_dev *ax25_dev; ax25_dev *ax25_dev;
ax25_cb *s; ax25_cb *s;
if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)
return; return;
spin_lock_irqsave(&ax25_list_lock, flags); spin_lock_bh(&ax25_list_lock);
for (s = ax25_list; s != NULL; s = s->next) { for (s = ax25_list; s != NULL; s = s->next) {
if (s->ax25_dev == ax25_dev) { if (s->ax25_dev == ax25_dev) {
s->ax25_dev = NULL; s->ax25_dev = NULL;
ax25_disconnect(s, ENETUNREACH); ax25_disconnect(s, ENETUNREACH);
} }
} }
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
} }
/* /*
...@@ -159,12 +157,10 @@ static int ax25_device_event(struct notifier_block *this, unsigned long event, ...@@ -159,12 +157,10 @@ static int ax25_device_event(struct notifier_block *this, unsigned long event,
*/ */
void ax25_insert_socket(ax25_cb *ax25) void ax25_insert_socket(ax25_cb *ax25)
{ {
unsigned long flags; spin_lock_bh(&ax25_list_lock);
spin_lock_irqsave(&ax25_list_lock, flags);
ax25->next = ax25_list; ax25->next = ax25_list;
ax25_list = ax25; ax25_list = ax25;
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
} }
/* /*
...@@ -174,23 +170,22 @@ void ax25_insert_socket(ax25_cb *ax25) ...@@ -174,23 +170,22 @@ void ax25_insert_socket(ax25_cb *ax25)
struct sock *ax25_find_listener(ax25_address *addr, int digi, struct sock *ax25_find_listener(ax25_address *addr, int digi,
struct net_device *dev, int type) struct net_device *dev, int type)
{ {
unsigned long flags;
ax25_cb *s; ax25_cb *s;
spin_lock_irqsave(&ax25_list_lock, flags); spin_lock_bh(&ax25_list_lock);
for (s = ax25_list; s != NULL; s = s->next) { for (s = ax25_list; s != NULL; s = s->next) {
if ((s->iamdigi && !digi) || (!s->iamdigi && digi)) if ((s->iamdigi && !digi) || (!s->iamdigi && digi))
continue; continue;
if (s->sk != NULL && ax25cmp(&s->source_addr, addr) == 0 && s->sk->type == type && s->sk->state == TCP_LISTEN) { if (s->sk != NULL && ax25cmp(&s->source_addr, addr) == 0 && s->sk->type == type && s->sk->state == TCP_LISTEN) {
/* If device is null we match any device */ /* If device is null we match any device */
if (s->ax25_dev == NULL || s->ax25_dev->dev == dev) { if (s->ax25_dev == NULL || s->ax25_dev->dev == dev) {
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
return s->sk; return s->sk;
} }
} }
} }
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
return NULL; return NULL;
} }
...@@ -202,10 +197,9 @@ struct sock *ax25_get_socket(ax25_address *my_addr, ax25_address *dest_addr, ...@@ -202,10 +197,9 @@ struct sock *ax25_get_socket(ax25_address *my_addr, ax25_address *dest_addr,
int type) int type)
{ {
struct sock *sk = NULL; struct sock *sk = NULL;
unsigned long flags;
ax25_cb *s; ax25_cb *s;
spin_lock_irqsave(&ax25_list_lock, flags); spin_lock_bh(&ax25_list_lock);
for (s = ax25_list; s != NULL; s = s->next) { for (s = ax25_list; s != NULL; s = s->next) {
if (s->sk != NULL && ax25cmp(&s->source_addr, my_addr) == 0 && ax25cmp(&s->dest_addr, dest_addr) == 0 && s->sk->type == type) { if (s->sk != NULL && ax25cmp(&s->source_addr, my_addr) == 0 && ax25cmp(&s->dest_addr, dest_addr) == 0 && s->sk->type == type) {
sk = s->sk; sk = s->sk;
...@@ -215,7 +209,7 @@ struct sock *ax25_get_socket(ax25_address *my_addr, ax25_address *dest_addr, ...@@ -215,7 +209,7 @@ struct sock *ax25_get_socket(ax25_address *my_addr, ax25_address *dest_addr,
} }
out: out:
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
return NULL; return NULL;
} }
...@@ -228,9 +222,8 @@ ax25_cb *ax25_find_cb(ax25_address *src_addr, ax25_address *dest_addr, ...@@ -228,9 +222,8 @@ ax25_cb *ax25_find_cb(ax25_address *src_addr, ax25_address *dest_addr,
ax25_digi *digi, struct net_device *dev) ax25_digi *digi, struct net_device *dev)
{ {
ax25_cb *s; ax25_cb *s;
unsigned long flags;
spin_lock_irqsave(&ax25_list_lock, flags); spin_lock_bh(&ax25_list_lock);
for (s = ax25_list; s != NULL; s = s->next) { for (s = ax25_list; s != NULL; s = s->next) {
if (s->sk != NULL && s->sk->type != SOCK_SEQPACKET) if (s->sk != NULL && s->sk->type != SOCK_SEQPACKET)
continue; continue;
...@@ -246,12 +239,12 @@ ax25_cb *ax25_find_cb(ax25_address *src_addr, ax25_address *dest_addr, ...@@ -246,12 +239,12 @@ ax25_cb *ax25_find_cb(ax25_address *src_addr, ax25_address *dest_addr,
if (s->digipeat != NULL && s->digipeat->ndigi != 0) if (s->digipeat != NULL && s->digipeat->ndigi != 0)
continue; continue;
} }
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
return s; return s;
} }
} }
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
return NULL; return NULL;
} }
...@@ -261,11 +254,10 @@ ax25_cb *ax25_find_cb(ax25_address *src_addr, ax25_address *dest_addr, ...@@ -261,11 +254,10 @@ ax25_cb *ax25_find_cb(ax25_address *src_addr, ax25_address *dest_addr,
*/ */
struct sock *ax25_addr_match(ax25_address *addr) struct sock *ax25_addr_match(ax25_address *addr)
{ {
unsigned long flags;
struct sock *sk = NULL; struct sock *sk = NULL;
ax25_cb *s; ax25_cb *s;
spin_lock_irqsave(&ax25_list_lock, flags); spin_lock_bh(&ax25_list_lock);
for (s = ax25_list; s != NULL; s = s->next) { for (s = ax25_list; s != NULL; s = s->next) {
if (s->sk != NULL && ax25cmp(&s->source_addr, addr) == 0 && if (s->sk != NULL && ax25cmp(&s->source_addr, addr) == 0 &&
s->sk->type == SOCK_RAW) { s->sk->type == SOCK_RAW) {
...@@ -274,7 +266,7 @@ struct sock *ax25_addr_match(ax25_address *addr) ...@@ -274,7 +266,7 @@ struct sock *ax25_addr_match(ax25_address *addr)
break; break;
} }
} }
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
return sk; return sk;
} }
...@@ -320,7 +312,6 @@ static void ax25_destroy_timer(unsigned long data) ...@@ -320,7 +312,6 @@ static void ax25_destroy_timer(unsigned long data)
void ax25_destroy_socket(ax25_cb *ax25) void ax25_destroy_socket(ax25_cb *ax25)
{ {
struct sk_buff *skb; struct sk_buff *skb;
unsigned long flags;
ax25_remove_socket(ax25); ax25_remove_socket(ax25);
...@@ -1847,14 +1838,13 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1847,14 +1838,13 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
static int ax25_get_info(char *buffer, char **start, off_t offset, int length) static int ax25_get_info(char *buffer, char **start, off_t offset, int length)
{ {
unsigned long flags;
ax25_cb *ax25; ax25_cb *ax25;
int k; int k;
int len = 0; int len = 0;
off_t pos = 0; off_t pos = 0;
off_t begin = 0; off_t begin = 0;
spin_lock_irqsave(&ax25_list_lock, flags); spin_lock_bh(&ax25_list_lock);
/* /*
* New format: * New format:
...@@ -1909,7 +1899,7 @@ static int ax25_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -1909,7 +1899,7 @@ static int ax25_get_info(char *buffer, char **start, off_t offset, int length)
break; break;
} }
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
*start = buffer + (offset - begin); *start = buffer + (offset - begin);
len -= (offset - begin); len -= (offset - begin);
......
...@@ -37,15 +37,14 @@ spinlock_t ax25_dev_lock = SPIN_LOCK_UNLOCKED; ...@@ -37,15 +37,14 @@ spinlock_t ax25_dev_lock = SPIN_LOCK_UNLOCKED;
ax25_dev *ax25_dev_ax25dev(struct net_device *dev) ax25_dev *ax25_dev_ax25dev(struct net_device *dev)
{ {
ax25_dev *ax25_dev, *res = NULL; ax25_dev *ax25_dev, *res = NULL;
unsigned long flags;
spin_lock_irqsave(&ax25_dev_lock, flags); spin_lock_bh(&ax25_dev_lock);
for (ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next) for (ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next)
if (ax25_dev->dev == dev) { if (ax25_dev->dev == dev) {
res = ax25_dev; res = ax25_dev;
break; break;
} }
spin_unlock_irqrestore(&ax25_dev_lock, flags); spin_unlock_bh(&ax25_dev_lock);
return res; return res;
} }
...@@ -53,14 +52,13 @@ ax25_dev *ax25_dev_ax25dev(struct net_device *dev) ...@@ -53,14 +52,13 @@ ax25_dev *ax25_dev_ax25dev(struct net_device *dev)
ax25_dev *ax25_addr_ax25dev(ax25_address *addr) ax25_dev *ax25_addr_ax25dev(ax25_address *addr)
{ {
ax25_dev *ax25_dev, *res = NULL; ax25_dev *ax25_dev, *res = NULL;
unsigned long flags;
spin_lock_irqsave(&ax25_dev_lock, flags); spin_lock_bh(&ax25_dev_lock);
for (ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next) for (ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next)
if (ax25cmp(addr, (ax25_address *)ax25_dev->dev->dev_addr) == 0) { if (ax25cmp(addr, (ax25_address *)ax25_dev->dev->dev_addr) == 0) {
res = ax25_dev; res = ax25_dev;
} }
spin_unlock_irqrestore(&ax25_dev_lock, flags); spin_unlock_bh(&ax25_dev_lock);
return res; return res;
} }
...@@ -72,7 +70,6 @@ ax25_dev *ax25_addr_ax25dev(ax25_address *addr) ...@@ -72,7 +70,6 @@ ax25_dev *ax25_addr_ax25dev(ax25_address *addr)
void ax25_dev_device_up(struct net_device *dev) void ax25_dev_device_up(struct net_device *dev)
{ {
ax25_dev *ax25_dev; ax25_dev *ax25_dev;
unsigned long flags;
if ((ax25_dev = kmalloc(sizeof(*ax25_dev), GFP_ATOMIC)) == NULL) { if ((ax25_dev = kmalloc(sizeof(*ax25_dev), GFP_ATOMIC)) == NULL) {
printk(KERN_ERR "AX.25: ax25_dev_device_up - out of memory\n"); printk(KERN_ERR "AX.25: ax25_dev_device_up - out of memory\n");
...@@ -101,10 +98,10 @@ void ax25_dev_device_up(struct net_device *dev) ...@@ -101,10 +98,10 @@ void ax25_dev_device_up(struct net_device *dev)
ax25_dev->values[AX25_VALUES_PROTOCOL] = AX25_DEF_PROTOCOL; ax25_dev->values[AX25_VALUES_PROTOCOL] = AX25_DEF_PROTOCOL;
ax25_dev->values[AX25_VALUES_DS_TIMEOUT]= AX25_DEF_DS_TIMEOUT; ax25_dev->values[AX25_VALUES_DS_TIMEOUT]= AX25_DEF_DS_TIMEOUT;
spin_lock_irqsave(&ax25_dev_lock, flags); spin_lock_bh(&ax25_dev_lock);
ax25_dev->next = ax25_dev_list; ax25_dev->next = ax25_dev_list;
ax25_dev_list = ax25_dev; ax25_dev_list = ax25_dev;
spin_unlock_irqrestore(&ax25_dev_lock, flags); spin_unlock_bh(&ax25_dev_lock);
ax25_register_sysctl(); ax25_register_sysctl();
} }
...@@ -112,14 +109,13 @@ void ax25_dev_device_up(struct net_device *dev) ...@@ -112,14 +109,13 @@ void ax25_dev_device_up(struct net_device *dev)
void ax25_dev_device_down(struct net_device *dev) void ax25_dev_device_down(struct net_device *dev)
{ {
ax25_dev *s, *ax25_dev; ax25_dev *s, *ax25_dev;
unsigned long flags;
if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)
return; return;
ax25_unregister_sysctl(); ax25_unregister_sysctl();
spin_lock_irqsave(&ax25_dev_lock, flags); spin_lock_bh(&ax25_dev_lock);
#ifdef CONFIG_AX25_DAMA_SLAVE #ifdef CONFIG_AX25_DAMA_SLAVE
ax25_ds_del_timer(ax25_dev); ax25_ds_del_timer(ax25_dev);
...@@ -134,7 +130,7 @@ void ax25_dev_device_down(struct net_device *dev) ...@@ -134,7 +130,7 @@ void ax25_dev_device_down(struct net_device *dev)
if ((s = ax25_dev_list) == ax25_dev) { if ((s = ax25_dev_list) == ax25_dev) {
ax25_dev_list = s->next; ax25_dev_list = s->next;
spin_unlock_irqrestore(&ax25_dev_lock, flags); spin_unlock_bh(&ax25_dev_lock);
kfree(ax25_dev); kfree(ax25_dev);
ax25_register_sysctl(); ax25_register_sysctl();
return; return;
...@@ -143,7 +139,7 @@ void ax25_dev_device_down(struct net_device *dev) ...@@ -143,7 +139,7 @@ void ax25_dev_device_down(struct net_device *dev)
while (s != NULL && s->next != NULL) { while (s != NULL && s->next != NULL) {
if (s->next == ax25_dev) { if (s->next == ax25_dev) {
s->next = ax25_dev->next; s->next = ax25_dev->next;
spin_unlock_irqrestore(&ax25_dev_lock, flags); spin_unlock_bh(&ax25_dev_lock);
kfree(ax25_dev); kfree(ax25_dev);
ax25_register_sysctl(); ax25_register_sysctl();
return; return;
...@@ -151,7 +147,7 @@ void ax25_dev_device_down(struct net_device *dev) ...@@ -151,7 +147,7 @@ void ax25_dev_device_down(struct net_device *dev)
s = s->next; s = s->next;
} }
spin_unlock_irqrestore(&ax25_dev_lock, flags); spin_unlock_bh(&ax25_dev_lock);
ax25_register_sysctl(); ax25_register_sysctl();
} }
...@@ -204,9 +200,8 @@ struct net_device *ax25_fwd_dev(struct net_device *dev) ...@@ -204,9 +200,8 @@ struct net_device *ax25_fwd_dev(struct net_device *dev)
void __exit ax25_dev_free(void) void __exit ax25_dev_free(void)
{ {
ax25_dev *s, *ax25_dev; ax25_dev *s, *ax25_dev;
unsigned long flags;
spin_lock_irqsave(&ax25_dev_lock, flags); spin_lock_bh(&ax25_dev_lock);
ax25_dev = ax25_dev_list; ax25_dev = ax25_dev_list;
while (ax25_dev != NULL) { while (ax25_dev != NULL) {
s = ax25_dev; s = ax25_dev;
...@@ -215,5 +210,5 @@ void __exit ax25_dev_free(void) ...@@ -215,5 +210,5 @@ void __exit ax25_dev_free(void)
kfree(s); kfree(s);
} }
ax25_dev_list = NULL; ax25_dev_list = NULL;
spin_unlock_irqrestore(&ax25_dev_lock, flags); spin_unlock_bh(&ax25_dev_lock);
} }
...@@ -39,7 +39,6 @@ void ax25_ds_nr_error_recovery(ax25_cb *ax25) ...@@ -39,7 +39,6 @@ void ax25_ds_nr_error_recovery(ax25_cb *ax25)
*/ */
void ax25_ds_enquiry_response(ax25_cb *ax25) void ax25_ds_enquiry_response(ax25_cb *ax25)
{ {
unsigned long flags;
ax25_cb *ax25o; ax25_cb *ax25o;
/* Please note that neither DK4EGs nor DG2FEFs /* Please note that neither DK4EGs nor DG2FEFs
...@@ -80,7 +79,7 @@ void ax25_ds_enquiry_response(ax25_cb *ax25) ...@@ -80,7 +79,7 @@ void ax25_ds_enquiry_response(ax25_cb *ax25)
ax25_start_t3timer(ax25); ax25_start_t3timer(ax25);
ax25_ds_set_timer(ax25->ax25_dev); ax25_ds_set_timer(ax25->ax25_dev);
spin_lock_irqsave(&ax25_list_lock, flags); spin_lock_bh(&ax25_list_lock);
for (ax25o = ax25_list; ax25o != NULL; ax25o = ax25o->next) { for (ax25o = ax25_list; ax25o != NULL; ax25o = ax25o->next) {
if (ax25o == ax25) if (ax25o == ax25)
continue; continue;
...@@ -106,7 +105,7 @@ void ax25_ds_enquiry_response(ax25_cb *ax25) ...@@ -106,7 +105,7 @@ void ax25_ds_enquiry_response(ax25_cb *ax25)
if (ax25o->state != AX25_STATE_0) if (ax25o->state != AX25_STATE_0)
ax25_start_t3timer(ax25o); ax25_start_t3timer(ax25o);
} }
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
} }
void ax25_ds_establish_data_link(ax25_cb *ax25) void ax25_ds_establish_data_link(ax25_cb *ax25)
...@@ -159,17 +158,16 @@ static void ax25_kiss_cmd(ax25_dev *ax25_dev, unsigned char cmd, unsigned char p ...@@ -159,17 +158,16 @@ static void ax25_kiss_cmd(ax25_dev *ax25_dev, unsigned char cmd, unsigned char p
*/ */
static int ax25_check_dama_slave(ax25_dev *ax25_dev) static int ax25_check_dama_slave(ax25_dev *ax25_dev)
{ {
unsigned long flags;
ax25_cb *ax25; ax25_cb *ax25;
int res = 0; int res = 0;
spin_lock_irqsave(&ax25_list_lock, flags); spin_lock_bh(&ax25_list_lock);
for (ax25 = ax25_list; ax25 != NULL ; ax25 = ax25->next) for (ax25 = ax25_list; ax25 != NULL ; ax25 = ax25->next)
if (ax25->ax25_dev == ax25_dev && (ax25->condition & AX25_COND_DAMA_MODE) && ax25->state > AX25_STATE_1) { if (ax25->ax25_dev == ax25_dev && (ax25->condition & AX25_COND_DAMA_MODE) && ax25->state > AX25_STATE_1) {
res = 1; res = 1;
break; break;
} }
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
return res; return res;
} }
......
...@@ -73,7 +73,6 @@ void ax25_ds_set_timer(ax25_dev *ax25_dev) ...@@ -73,7 +73,6 @@ void ax25_ds_set_timer(ax25_dev *ax25_dev)
static void ax25_ds_timeout(unsigned long arg) static void ax25_ds_timeout(unsigned long arg)
{ {
ax25_dev *ax25_dev = (struct ax25_dev *) arg; ax25_dev *ax25_dev = (struct ax25_dev *) arg;
unsigned long flags;
ax25_cb *ax25; ax25_cb *ax25;
if (ax25_dev == NULL || !ax25_dev->dama.slave) if (ax25_dev == NULL || !ax25_dev->dama.slave)
...@@ -84,7 +83,7 @@ static void ax25_ds_timeout(unsigned long arg) ...@@ -84,7 +83,7 @@ static void ax25_ds_timeout(unsigned long arg)
return; return;
} }
spin_lock_irqsave(&ax25_list_lock, flags); spin_lock_bh(&ax25_list_lock);
for (ax25=ax25_list; ax25 != NULL; ax25 = ax25->next) { for (ax25=ax25_list; ax25 != NULL; ax25 = ax25->next) {
if (ax25->ax25_dev != ax25_dev || !(ax25->condition & AX25_COND_DAMA_MODE)) if (ax25->ax25_dev != ax25_dev || !(ax25->condition & AX25_COND_DAMA_MODE))
continue; continue;
...@@ -92,7 +91,7 @@ static void ax25_ds_timeout(unsigned long arg) ...@@ -92,7 +91,7 @@ static void ax25_ds_timeout(unsigned long arg)
ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND);
ax25_disconnect(ax25, ETIMEDOUT); ax25_disconnect(ax25, ETIMEDOUT);
} }
spin_unlock_irqrestore(&ax25_list_lock, flags); spin_unlock_bh(&ax25_list_lock);
ax25_dev_dama_off(ax25_dev); ax25_dev_dama_off(ax25_dev);
} }
......
...@@ -109,17 +109,16 @@ void ax25_protocol_release(unsigned int pid) ...@@ -109,17 +109,16 @@ void ax25_protocol_release(unsigned int pid)
int ax25_linkfail_register(void (*func)(ax25_cb *, int)) int ax25_linkfail_register(void (*func)(ax25_cb *, int))
{ {
struct linkfail_struct *linkfail; struct linkfail_struct *linkfail;
unsigned long flags;
if ((linkfail = kmalloc(sizeof(*linkfail), GFP_ATOMIC)) == NULL) if ((linkfail = kmalloc(sizeof(*linkfail), GFP_ATOMIC)) == NULL)
return 0; return 0;
linkfail->func = func; linkfail->func = func;
spin_lock_irqsave(&linkfail_lock, flags); spin_lock_bh(&linkfail_lock);
linkfail->next = linkfail_list; linkfail->next = linkfail_list;
linkfail_list = linkfail; linkfail_list = linkfail;
spin_unlock_irqrestore(&linkfail_lock, flags); spin_unlock_bh(&linkfail_lock);
return 1; return 1;
} }
...@@ -127,16 +126,15 @@ int ax25_linkfail_register(void (*func)(ax25_cb *, int)) ...@@ -127,16 +126,15 @@ int ax25_linkfail_register(void (*func)(ax25_cb *, int))
void ax25_linkfail_release(void (*func)(ax25_cb *, int)) void ax25_linkfail_release(void (*func)(ax25_cb *, int))
{ {
struct linkfail_struct *s, *linkfail; struct linkfail_struct *s, *linkfail;
unsigned long flags;
spin_lock_irqsave(&linkfail_lock, flags); spin_lock_bh(&linkfail_lock);
linkfail = linkfail_list; linkfail = linkfail_list;
if (linkfail == NULL) if (linkfail == NULL)
return; return;
if (linkfail->func == func) { if (linkfail->func == func) {
linkfail_list = linkfail->next; linkfail_list = linkfail->next;
spin_unlock_irqrestore(&linkfail_lock, flags); spin_unlock_bh(&linkfail_lock);
kfree(linkfail); kfree(linkfail);
return; return;
} }
...@@ -145,20 +143,19 @@ void ax25_linkfail_release(void (*func)(ax25_cb *, int)) ...@@ -145,20 +143,19 @@ void ax25_linkfail_release(void (*func)(ax25_cb *, int))
if (linkfail->next->func == func) { if (linkfail->next->func == func) {
s = linkfail->next; s = linkfail->next;
linkfail->next = linkfail->next->next; linkfail->next = linkfail->next->next;
spin_unlock_irqrestore(&linkfail_lock, flags); spin_unlock_bh(&linkfail_lock);
kfree(s); kfree(s);
return; return;
} }
linkfail = linkfail->next; linkfail = linkfail->next;
} }
spin_unlock_irqrestore(&linkfail_lock, flags); spin_unlock_bh(&linkfail_lock);
} }
int ax25_listen_register(ax25_address *callsign, struct net_device *dev) int ax25_listen_register(ax25_address *callsign, struct net_device *dev)
{ {
struct listen_struct *listen; struct listen_struct *listen;
unsigned long flags;
if (ax25_listen_mine(callsign, dev)) if (ax25_listen_mine(callsign, dev))
return 0; return 0;
...@@ -169,10 +166,10 @@ int ax25_listen_register(ax25_address *callsign, struct net_device *dev) ...@@ -169,10 +166,10 @@ int ax25_listen_register(ax25_address *callsign, struct net_device *dev)
listen->callsign = *callsign; listen->callsign = *callsign;
listen->dev = dev; listen->dev = dev;
spin_lock_irqsave(&listen_lock, flags); spin_lock_bh(&listen_lock);
listen->next = listen_list; listen->next = listen_list;
listen_list = listen; listen_list = listen;
spin_unlock_irqrestore(&listen_lock, flags); spin_unlock_bh(&listen_lock);
return 1; return 1;
} }
...@@ -180,16 +177,15 @@ int ax25_listen_register(ax25_address *callsign, struct net_device *dev) ...@@ -180,16 +177,15 @@ int ax25_listen_register(ax25_address *callsign, struct net_device *dev)
void ax25_listen_release(ax25_address *callsign, struct net_device *dev) void ax25_listen_release(ax25_address *callsign, struct net_device *dev)
{ {
struct listen_struct *s, *listen; struct listen_struct *s, *listen;
unsigned long flags;
spin_lock_irqsave(&listen_lock, flags); spin_lock_bh(&listen_lock);
listen = listen_list; listen = listen_list;
if (listen == NULL) if (listen == NULL)
return; return;
if (ax25cmp(&listen->callsign, callsign) == 0 && listen->dev == dev) { if (ax25cmp(&listen->callsign, callsign) == 0 && listen->dev == dev) {
listen_list = listen->next; listen_list = listen->next;
spin_unlock_irqrestore(&listen_lock, flags); spin_unlock_bh(&listen_lock);
kfree(listen); kfree(listen);
return; return;
} }
...@@ -198,14 +194,14 @@ void ax25_listen_release(ax25_address *callsign, struct net_device *dev) ...@@ -198,14 +194,14 @@ void ax25_listen_release(ax25_address *callsign, struct net_device *dev)
if (ax25cmp(&listen->next->callsign, callsign) == 0 && listen->next->dev == dev) { if (ax25cmp(&listen->next->callsign, callsign) == 0 && listen->next->dev == dev) {
s = listen->next; s = listen->next;
listen->next = listen->next->next; listen->next = listen->next->next;
spin_unlock_irqrestore(&listen_lock, flags); spin_unlock_bh(&listen_lock);
kfree(s); kfree(s);
return; return;
} }
listen = listen->next; listen = listen->next;
} }
spin_unlock_irqrestore(&listen_lock, flags); spin_unlock_bh(&listen_lock);
} }
int (*ax25_protocol_function(unsigned int pid))(struct sk_buff *, ax25_cb *) int (*ax25_protocol_function(unsigned int pid))(struct sk_buff *, ax25_cb *)
...@@ -227,13 +223,12 @@ int (*ax25_protocol_function(unsigned int pid))(struct sk_buff *, ax25_cb *) ...@@ -227,13 +223,12 @@ int (*ax25_protocol_function(unsigned int pid))(struct sk_buff *, ax25_cb *)
int ax25_listen_mine(ax25_address *callsign, struct net_device *dev) int ax25_listen_mine(ax25_address *callsign, struct net_device *dev)
{ {
struct listen_struct *listen; struct listen_struct *listen;
unsigned long flags;
spin_lock_irqsave(&listen_lock, flags); spin_lock_bh(&listen_lock);
for (listen = listen_list; listen != NULL; listen = listen->next) for (listen = listen_list; listen != NULL; listen = listen->next)
if (ax25cmp(&listen->callsign, callsign) == 0 && (listen->dev == dev || listen->dev == NULL)) if (ax25cmp(&listen->callsign, callsign) == 0 && (listen->dev == dev || listen->dev == NULL))
return 1; return 1;
spin_unlock_irqrestore(&listen_lock, flags); spin_unlock_bh(&listen_lock);
return 0; return 0;
} }
...@@ -241,12 +236,11 @@ int ax25_listen_mine(ax25_address *callsign, struct net_device *dev) ...@@ -241,12 +236,11 @@ int ax25_listen_mine(ax25_address *callsign, struct net_device *dev)
void ax25_link_failed(ax25_cb *ax25, int reason) void ax25_link_failed(ax25_cb *ax25, int reason)
{ {
struct linkfail_struct *linkfail; struct linkfail_struct *linkfail;
unsigned long flags;
spin_lock_irqsave(&linkfail_lock, flags); spin_lock_bh(&linkfail_lock);
for (linkfail = linkfail_list; linkfail != NULL; linkfail = linkfail->next) for (linkfail = linkfail_list; linkfail != NULL; linkfail = linkfail->next)
(linkfail->func)(ax25, reason); (linkfail->func)(ax25, reason);
spin_unlock_irqrestore(&linkfail_lock, flags); spin_unlock_bh(&linkfail_lock);
} }
int ax25_protocol_is_registered(unsigned int pid) int ax25_protocol_is_registered(unsigned int pid)
......
...@@ -115,7 +115,6 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) ...@@ -115,7 +115,6 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
struct sk_buff *skbn; struct sk_buff *skbn;
unsigned char *p; unsigned char *p;
int frontlen, len, fragno, ka9qfrag, first = 1; int frontlen, len, fragno, ka9qfrag, first = 1;
long flags;
if ((skb->len - 1) > paclen) { if ((skb->len - 1) > paclen) {
if (*skb->data == AX25_P_TEXT) { if (*skb->data == AX25_P_TEXT) {
...@@ -132,9 +131,9 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) ...@@ -132,9 +131,9 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
frontlen = skb_headroom(skb); /* Address space + CTRL */ frontlen = skb_headroom(skb); /* Address space + CTRL */
while (skb->len > 0) { while (skb->len > 0) {
spin_lock_irqsave(&ax25_frag_lock, flags); spin_lock_bh(&ax25_frag_lock);
if ((skbn = alloc_skb(paclen + 2 + frontlen, GFP_ATOMIC)) == NULL) { if ((skbn = alloc_skb(paclen + 2 + frontlen, GFP_ATOMIC)) == NULL) {
spin_unlock_irqrestore(&ax25_frag_lock, flags); spin_unlock_bh(&ax25_frag_lock);
printk(KERN_CRIT "AX.25: ax25_output - out of memory\n"); printk(KERN_CRIT "AX.25: ax25_output - out of memory\n");
return; return;
} }
...@@ -142,7 +141,7 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) ...@@ -142,7 +141,7 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
if (skb->sk != NULL) if (skb->sk != NULL)
skb_set_owner_w(skbn, skb->sk); skb_set_owner_w(skbn, skb->sk);
spin_unlock_irqrestore(&ax25_frag_lock, flags); spin_unlock_bh(&ax25_frag_lock);
len = (paclen > skb->len) ? skb->len : paclen; len = (paclen > skb->len) ? skb->len : paclen;
......
...@@ -104,11 +104,10 @@ static const ctl_table ax25_param_table[] = { ...@@ -104,11 +104,10 @@ static const ctl_table ax25_param_table[] = {
void ax25_register_sysctl(void) void ax25_register_sysctl(void)
{ {
unsigned long flags;
ax25_dev *ax25_dev; ax25_dev *ax25_dev;
int n, k; int n, k;
spin_lock_irqsave(&ax25_dev_lock, flags); spin_lock_bh(&ax25_dev_lock);
for (ax25_table_size = sizeof(ctl_table), ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next) for (ax25_table_size = sizeof(ctl_table), ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next)
ax25_table_size += sizeof(ctl_table); ax25_table_size += sizeof(ctl_table);
...@@ -123,7 +122,7 @@ void ax25_register_sysctl(void) ...@@ -123,7 +122,7 @@ void ax25_register_sysctl(void)
while (n--) while (n--)
kfree(ax25_table[n].child); kfree(ax25_table[n].child);
kfree(ax25_table); kfree(ax25_table);
spin_unlock_irqrestore(&ax25_dev_lock, flags); spin_unlock_bh(&ax25_dev_lock);
return; return;
} }
memcpy(child, ax25_param_table, sizeof(ax25_param_table)); memcpy(child, ax25_param_table, sizeof(ax25_param_table));
...@@ -149,7 +148,7 @@ void ax25_register_sysctl(void) ...@@ -149,7 +148,7 @@ void ax25_register_sysctl(void)
n++; n++;
} }
spin_unlock_irqrestore(&ax25_dev_lock, flags); spin_unlock_bh(&ax25_dev_lock);
ax25_dir_table[0].child = ax25_table; ax25_dir_table[0].child = ax25_table;
......
...@@ -99,27 +99,26 @@ decmod: MOD_DEC_USE_COUNT; ...@@ -99,27 +99,26 @@ decmod: MOD_DEC_USE_COUNT;
static void nr_remove_socket(struct sock *sk) static void nr_remove_socket(struct sock *sk)
{ {
struct sock *s; struct sock *s;
unsigned long flags;
spin_lock_irqsave(&nr_list_lock, flags); spin_lock_bh(&nr_list_lock);
if ((s = nr_list) == sk) { if ((s = nr_list) == sk) {
nr_list = s->next; nr_list = s->next;
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
return; return;
} }
while (s != NULL && s->next != NULL) { while (s != NULL && s->next != NULL) {
if (s->next == sk) { if (s->next == sk) {
s->next = sk->next; s->next = sk->next;
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
return; return;
} }
s = s->next; s = s->next;
} }
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
} }
/* /*
...@@ -127,15 +126,14 @@ static void nr_remove_socket(struct sock *sk) ...@@ -127,15 +126,14 @@ static void nr_remove_socket(struct sock *sk)
*/ */
static void nr_kill_by_device(struct net_device *dev) static void nr_kill_by_device(struct net_device *dev)
{ {
unsigned long flags;
struct sock *s; struct sock *s;
spin_lock_irqsave(&nr_list_lock, flags); spin_lock_bh(&nr_list_lock);
for (s = nr_list; s != NULL; s = s->next) { for (s = nr_list; s != NULL; s = s->next) {
if (nr_sk(s)->device == dev) if (nr_sk(s)->device == dev)
nr_disconnect(s, ENETUNREACH); nr_disconnect(s, ENETUNREACH);
} }
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
} }
/* /*
...@@ -159,12 +157,10 @@ static int nr_device_event(struct notifier_block *this, unsigned long event, voi ...@@ -159,12 +157,10 @@ static int nr_device_event(struct notifier_block *this, unsigned long event, voi
*/ */
static void nr_insert_socket(struct sock *sk) static void nr_insert_socket(struct sock *sk)
{ {
unsigned long flags; spin_lock_bh(&nr_list_lock);
spin_lock_irqsave(&nr_list_lock, flags);
sk->next = nr_list; sk->next = nr_list;
nr_list = sk; nr_list = sk;
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
} }
/* /*
...@@ -173,18 +169,17 @@ static void nr_insert_socket(struct sock *sk) ...@@ -173,18 +169,17 @@ static void nr_insert_socket(struct sock *sk)
*/ */
static struct sock *nr_find_listener(ax25_address *addr) static struct sock *nr_find_listener(ax25_address *addr)
{ {
unsigned long flags;
struct sock *s; struct sock *s;
spin_lock_irqsave(&nr_list_lock, flags); spin_lock_bh(&nr_list_lock);
for (s = nr_list; s != NULL; s = s->next) { for (s = nr_list; s != NULL; s = s->next) {
if (!ax25cmp(&nr_sk(s)->source_addr, addr) && if (!ax25cmp(&nr_sk(s)->source_addr, addr) &&
s->state == TCP_LISTEN) { s->state == TCP_LISTEN) {
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
return s; return s;
} }
} }
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
return NULL; return NULL;
} }
...@@ -195,18 +190,17 @@ static struct sock *nr_find_listener(ax25_address *addr) ...@@ -195,18 +190,17 @@ static struct sock *nr_find_listener(ax25_address *addr)
static struct sock *nr_find_socket(unsigned char index, unsigned char id) static struct sock *nr_find_socket(unsigned char index, unsigned char id)
{ {
struct sock *s; struct sock *s;
unsigned long flags;
spin_lock_irqsave(&nr_list_lock, flags); spin_lock_bh(&nr_list_lock);
for (s = nr_list; s != NULL; s = s->next) { for (s = nr_list; s != NULL; s = s->next) {
nr_cb *nr = nr_sk(s); nr_cb *nr = nr_sk(s);
if (nr->my_index == index && nr->my_id == id) { if (nr->my_index == index && nr->my_id == id) {
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
return s; return s;
} }
} }
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
return NULL; return NULL;
} }
...@@ -217,20 +211,19 @@ static struct sock *nr_find_socket(unsigned char index, unsigned char id) ...@@ -217,20 +211,19 @@ static struct sock *nr_find_socket(unsigned char index, unsigned char id)
static struct sock *nr_find_peer(unsigned char index, unsigned char id, static struct sock *nr_find_peer(unsigned char index, unsigned char id,
ax25_address *dest) ax25_address *dest)
{ {
unsigned long flags;
struct sock *s; struct sock *s;
spin_lock_irqsave(&nr_list_lock, flags); spin_lock_bh(&nr_list_lock);
for (s = nr_list; s != NULL; s = s->next) { for (s = nr_list; s != NULL; s = s->next) {
nr_cb *nr = nr_sk(s); nr_cb *nr = nr_sk(s);
if (nr->your_index == index && nr->your_id == id && if (nr->your_index == index && nr->your_id == id &&
!ax25cmp(&nr->dest_addr, dest)) { !ax25cmp(&nr->dest_addr, dest)) {
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
return s; return s;
} }
} }
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
return NULL; return NULL;
} }
...@@ -1164,7 +1157,6 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1164,7 +1157,6 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
static int nr_get_info(char *buffer, char **start, off_t offset, int length) static int nr_get_info(char *buffer, char **start, off_t offset, int length)
{ {
unsigned long flags;
struct sock *s; struct sock *s;
struct net_device *dev; struct net_device *dev;
const char *devname; const char *devname;
...@@ -1172,7 +1164,7 @@ static int nr_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -1172,7 +1164,7 @@ static int nr_get_info(char *buffer, char **start, off_t offset, int length)
off_t pos = 0; off_t pos = 0;
off_t begin = 0; off_t begin = 0;
spin_lock_irqsave(&nr_list_lock, flags); spin_lock_bh(&nr_list_lock);
len += sprintf(buffer, "user_addr dest_node src_node dev my your st vs vr va t1 t2 t4 idle n2 wnd Snd-Q Rcv-Q inode\n"); len += sprintf(buffer, "user_addr dest_node src_node dev my your st vs vr va t1 t2 t4 idle n2 wnd Snd-Q Rcv-Q inode\n");
...@@ -1225,7 +1217,7 @@ static int nr_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -1225,7 +1217,7 @@ static int nr_get_info(char *buffer, char **start, off_t offset, int length)
break; break;
} }
spin_unlock_irqrestore(&nr_list_lock, flags); spin_unlock_bh(&nr_list_lock);
*start = buffer + (offset - begin); *start = buffer + (offset - begin);
len -= (offset - begin); len -= (offset - begin);
......
...@@ -56,7 +56,6 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2 ...@@ -56,7 +56,6 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2
struct nr_node *nr_node; struct nr_node *nr_node;
struct nr_neigh *nr_neigh; struct nr_neigh *nr_neigh;
struct nr_route nr_route; struct nr_route nr_route;
unsigned long flags;
int i, found; int i, found;
if (nr_dev_get(nr) != NULL) /* Can't add routes to ourself */ if (nr_dev_get(nr) != NULL) /* Can't add routes to ourself */
...@@ -114,10 +113,10 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2 ...@@ -114,10 +113,10 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2
memcpy(nr_neigh->digipeat, ax25_digi, sizeof(ax25_digi)); memcpy(nr_neigh->digipeat, ax25_digi, sizeof(ax25_digi));
} }
spin_lock_irqsave(&nr_neigh_lock, flags); spin_lock_bh(&nr_neigh_lock);
nr_neigh->next = nr_neigh_list; nr_neigh->next = nr_neigh_list;
nr_neigh_list = nr_neigh; nr_neigh_list = nr_neigh;
spin_unlock_irqrestore(&nr_neigh_lock, flags); spin_unlock_bh(&nr_neigh_lock);
} }
if (quality != 0 && ax25cmp(nr, ax25) == 0 && !nr_neigh->locked) if (quality != 0 && ax25cmp(nr, ax25) == 0 && !nr_neigh->locked)
...@@ -137,10 +136,10 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2 ...@@ -137,10 +136,10 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2
nr_node->routes[0].obs_count = obs_count; nr_node->routes[0].obs_count = obs_count;
nr_node->routes[0].neighbour = nr_neigh; nr_node->routes[0].neighbour = nr_neigh;
spin_lock_irqsave(&nr_node_lock, flags); spin_lock_bh(&nr_node_lock);
nr_node->next = nr_node_list; nr_node->next = nr_node_list;
nr_node_list = nr_node; nr_node_list = nr_node;
spin_unlock_irqrestore(&nr_node_lock, flags); spin_unlock_bh(&nr_node_lock);
nr_neigh->count++; nr_neigh->count++;
...@@ -250,12 +249,11 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2 ...@@ -250,12 +249,11 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2
static void nr_remove_node(struct nr_node *nr_node) static void nr_remove_node(struct nr_node *nr_node)
{ {
struct nr_node *s; struct nr_node *s;
unsigned long flags;
spin_lock_irqsave(&nr_node_lock, flags); spin_lock_bh(&nr_node_lock);
if ((s = nr_node_list) == nr_node) { if ((s = nr_node_list) == nr_node) {
nr_node_list = nr_node->next; nr_node_list = nr_node->next;
spin_unlock_irqrestore(&nr_node_lock, flags); spin_unlock_bh(&nr_node_lock);
kfree(nr_node); kfree(nr_node);
return; return;
} }
...@@ -263,7 +261,7 @@ static void nr_remove_node(struct nr_node *nr_node) ...@@ -263,7 +261,7 @@ static void nr_remove_node(struct nr_node *nr_node)
while (s != NULL && s->next != NULL) { while (s != NULL && s->next != NULL) {
if (s->next == nr_node) { if (s->next == nr_node) {
s->next = nr_node->next; s->next = nr_node->next;
spin_unlock_irqrestore(&nr_node_lock, flags); spin_unlock_bh(&nr_node_lock);
kfree(nr_node); kfree(nr_node);
return; return;
} }
...@@ -271,18 +269,17 @@ static void nr_remove_node(struct nr_node *nr_node) ...@@ -271,18 +269,17 @@ static void nr_remove_node(struct nr_node *nr_node)
s = s->next; s = s->next;
} }
spin_unlock_irqrestore(&nr_node_lock, flags); spin_unlock_bh(&nr_node_lock);
} }
static void nr_remove_neigh(struct nr_neigh *nr_neigh) static void nr_remove_neigh(struct nr_neigh *nr_neigh)
{ {
struct nr_neigh *s; struct nr_neigh *s;
unsigned long flags;
spin_lock_irqsave(&nr_neigh_lock, flags); spin_lock_bh(&nr_neigh_lock);
if ((s = nr_neigh_list) == nr_neigh) { if ((s = nr_neigh_list) == nr_neigh) {
nr_neigh_list = nr_neigh->next; nr_neigh_list = nr_neigh->next;
spin_unlock_irqrestore(&nr_neigh_lock, flags); spin_unlock_bh(&nr_neigh_lock);
if (nr_neigh->digipeat != NULL) if (nr_neigh->digipeat != NULL)
kfree(nr_neigh->digipeat); kfree(nr_neigh->digipeat);
kfree(nr_neigh); kfree(nr_neigh);
...@@ -292,7 +289,7 @@ static void nr_remove_neigh(struct nr_neigh *nr_neigh) ...@@ -292,7 +289,7 @@ static void nr_remove_neigh(struct nr_neigh *nr_neigh)
while (s != NULL && s->next != NULL) { while (s != NULL && s->next != NULL) {
if (s->next == nr_neigh) { if (s->next == nr_neigh) {
s->next = nr_neigh->next; s->next = nr_neigh->next;
spin_unlock_irqrestore(&nr_neigh_lock, flags); spin_unlock_bh(&nr_neigh_lock);
if (nr_neigh->digipeat != NULL) if (nr_neigh->digipeat != NULL)
kfree(nr_neigh->digipeat); kfree(nr_neigh->digipeat);
kfree(nr_neigh); kfree(nr_neigh);
...@@ -301,7 +298,7 @@ static void nr_remove_neigh(struct nr_neigh *nr_neigh) ...@@ -301,7 +298,7 @@ static void nr_remove_neigh(struct nr_neigh *nr_neigh)
s = s->next; s = s->next;
} }
spin_unlock_irqrestore(&nr_neigh_lock, flags); spin_unlock_bh(&nr_neigh_lock);
} }
/* /*
...@@ -363,7 +360,6 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct n ...@@ -363,7 +360,6 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct n
static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct net_device *dev, unsigned int quality) static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct net_device *dev, unsigned int quality)
{ {
struct nr_neigh *nr_neigh; struct nr_neigh *nr_neigh;
unsigned long flags;
for (nr_neigh = nr_neigh_list; nr_neigh != NULL; nr_neigh = nr_neigh->next) { for (nr_neigh = nr_neigh_list; nr_neigh != NULL; nr_neigh = nr_neigh->next) {
if (ax25cmp(callsign, &nr_neigh->callsign) == 0 && nr_neigh->dev == dev) { if (ax25cmp(callsign, &nr_neigh->callsign) == 0 && nr_neigh->dev == dev) {
...@@ -394,10 +390,10 @@ static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct net ...@@ -394,10 +390,10 @@ static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct net
memcpy(nr_neigh->digipeat, ax25_digi, sizeof(ax25_digi)); memcpy(nr_neigh->digipeat, ax25_digi, sizeof(ax25_digi));
} }
spin_lock_irqsave(&nr_neigh_lock, flags); spin_lock_bh(&nr_neigh_lock);
nr_neigh->next = nr_neigh_list; nr_neigh->next = nr_neigh_list;
nr_neigh_list = nr_neigh; nr_neigh_list = nr_neigh;
spin_unlock_irqrestore(&nr_neigh_lock, flags); spin_unlock_bh(&nr_neigh_lock);
return 0; return 0;
} }
...@@ -738,13 +734,12 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25) ...@@ -738,13 +734,12 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
int nr_nodes_get_info(char *buffer, char **start, off_t offset, int length) int nr_nodes_get_info(char *buffer, char **start, off_t offset, int length)
{ {
struct nr_node *nr_node; struct nr_node *nr_node;
unsigned long flags;
int len = 0; int len = 0;
off_t pos = 0; off_t pos = 0;
off_t begin = 0; off_t begin = 0;
int i; int i;
spin_lock_irqsave(&nr_node_lock, flags); spin_lock_bh(&nr_node_lock);
len += sprintf(buffer, "callsign mnemonic w n qual obs neigh qual obs neigh qual obs neigh\n"); len += sprintf(buffer, "callsign mnemonic w n qual obs neigh qual obs neigh qual obs neigh\n");
for (nr_node = nr_node_list; nr_node != NULL; nr_node = nr_node->next) { for (nr_node = nr_node_list; nr_node != NULL; nr_node = nr_node->next) {
...@@ -773,7 +768,7 @@ int nr_nodes_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -773,7 +768,7 @@ int nr_nodes_get_info(char *buffer, char **start, off_t offset, int length)
if (pos > offset + length) if (pos > offset + length)
break; break;
} }
spin_unlock_irqrestore(&nr_node_lock, flags); spin_unlock_bh(&nr_node_lock);
*start = buffer + (offset - begin); *start = buffer + (offset - begin);
len -= (offset - begin); len -= (offset - begin);
...@@ -786,13 +781,12 @@ int nr_nodes_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -786,13 +781,12 @@ int nr_nodes_get_info(char *buffer, char **start, off_t offset, int length)
int nr_neigh_get_info(char *buffer, char **start, off_t offset, int length) int nr_neigh_get_info(char *buffer, char **start, off_t offset, int length)
{ {
struct nr_neigh *nr_neigh; struct nr_neigh *nr_neigh;
unsigned long flags;
int len = 0; int len = 0;
off_t pos = 0; off_t pos = 0;
off_t begin = 0; off_t begin = 0;
int i; int i;
spin_lock_irqsave(&nr_neigh_lock, flags); spin_lock_bh(&nr_neigh_lock);
len += sprintf(buffer, "addr callsign dev qual lock count failed digipeaters\n"); len += sprintf(buffer, "addr callsign dev qual lock count failed digipeaters\n");
for (nr_neigh = nr_neigh_list; nr_neigh != NULL; nr_neigh = nr_neigh->next) { for (nr_neigh = nr_neigh_list; nr_neigh != NULL; nr_neigh = nr_neigh->next) {
...@@ -823,7 +817,7 @@ int nr_neigh_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -823,7 +817,7 @@ int nr_neigh_get_info(char *buffer, char **start, off_t offset, int length)
break; break;
} }
spin_unlock_irqrestore(&nr_neigh_lock, flags); spin_unlock_bh(&nr_neigh_lock);
*start = buffer + (offset - begin); *start = buffer + (offset - begin);
len -= (offset - begin); len -= (offset - begin);
......
...@@ -160,25 +160,24 @@ decmod: MOD_DEC_USE_COUNT; ...@@ -160,25 +160,24 @@ decmod: MOD_DEC_USE_COUNT;
static void rose_remove_socket(struct sock *sk) static void rose_remove_socket(struct sock *sk)
{ {
struct sock *s; struct sock *s;
unsigned long flags;
spin_lock_irqsave(&rose_list_lock, flags); spin_lock_bh(&rose_list_lock);
if ((s = rose_list) == sk) { if ((s = rose_list) == sk) {
rose_list = s->next; rose_list = s->next;
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
return; return;
} }
while (s != NULL && s->next != NULL) { while (s != NULL && s->next != NULL) {
if (s->next == sk) { if (s->next == sk) {
s->next = sk->next; s->next = sk->next;
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
return; return;
} }
s = s->next; s = s->next;
} }
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
} }
/* /*
...@@ -187,10 +186,9 @@ static void rose_remove_socket(struct sock *sk) ...@@ -187,10 +186,9 @@ static void rose_remove_socket(struct sock *sk)
*/ */
void rose_kill_by_neigh(struct rose_neigh *neigh) void rose_kill_by_neigh(struct rose_neigh *neigh)
{ {
unsigned long flags;
struct sock *s; struct sock *s;
spin_lock_irqsave(&rose_list_lock, flags); spin_lock_bh(&rose_list_lock);
for (s = rose_list; s != NULL; s = s->next) { for (s = rose_list; s != NULL; s = s->next) {
rose_cb *rose = rose_sk(s); rose_cb *rose = rose_sk(s);
...@@ -200,7 +198,7 @@ void rose_kill_by_neigh(struct rose_neigh *neigh) ...@@ -200,7 +198,7 @@ void rose_kill_by_neigh(struct rose_neigh *neigh)
rose->neighbour = NULL; rose->neighbour = NULL;
} }
} }
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
} }
/* /*
...@@ -208,10 +206,9 @@ void rose_kill_by_neigh(struct rose_neigh *neigh) ...@@ -208,10 +206,9 @@ void rose_kill_by_neigh(struct rose_neigh *neigh)
*/ */
static void rose_kill_by_device(struct net_device *dev) static void rose_kill_by_device(struct net_device *dev)
{ {
unsigned long flags;
struct sock *s; struct sock *s;
spin_lock_irqsave(&rose_list_lock, flags); spin_lock_bh(&rose_list_lock);
for (s = rose_list; s != NULL; s = s->next) { for (s = rose_list; s != NULL; s = s->next) {
rose_cb *rose = rose_sk(s); rose_cb *rose = rose_sk(s);
...@@ -221,7 +218,7 @@ static void rose_kill_by_device(struct net_device *dev) ...@@ -221,7 +218,7 @@ static void rose_kill_by_device(struct net_device *dev)
rose->device = NULL; rose->device = NULL;
} }
} }
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
} }
/* /*
...@@ -253,12 +250,11 @@ static int rose_device_event(struct notifier_block *this, unsigned long event, ...@@ -253,12 +250,11 @@ static int rose_device_event(struct notifier_block *this, unsigned long event,
*/ */
static void rose_insert_socket(struct sock *sk) static void rose_insert_socket(struct sock *sk)
{ {
unsigned long flags;
spin_lock_irqsave(&rose_list_lock, flags); spin_lock_bh(&rose_list_lock);
sk->next = rose_list; sk->next = rose_list;
rose_list = sk; rose_list = sk;
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
} }
/* /*
...@@ -267,17 +263,16 @@ static void rose_insert_socket(struct sock *sk) ...@@ -267,17 +263,16 @@ static void rose_insert_socket(struct sock *sk)
*/ */
static struct sock *rose_find_listener(rose_address *addr, ax25_address *call) static struct sock *rose_find_listener(rose_address *addr, ax25_address *call)
{ {
unsigned long flags;
struct sock *s; struct sock *s;
spin_lock_irqsave(&rose_list_lock, flags); spin_lock_bh(&rose_list_lock);
for (s = rose_list; s != NULL; s = s->next) { for (s = rose_list; s != NULL; s = s->next) {
rose_cb *rose = rose_sk(s); rose_cb *rose = rose_sk(s);
if (!rosecmp(&rose->source_addr, addr) && if (!rosecmp(&rose->source_addr, addr) &&
!ax25cmp(&rose->source_call, call) && !ax25cmp(&rose->source_call, call) &&
!rose->source_ndigis && s->state == TCP_LISTEN) { !rose->source_ndigis && s->state == TCP_LISTEN) {
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
return s; return s;
} }
} }
...@@ -288,11 +283,11 @@ static struct sock *rose_find_listener(rose_address *addr, ax25_address *call) ...@@ -288,11 +283,11 @@ static struct sock *rose_find_listener(rose_address *addr, ax25_address *call)
if (!rosecmp(&rose->source_addr, addr) && if (!rosecmp(&rose->source_addr, addr) &&
!ax25cmp(&rose->source_call, &null_ax25_address) && !ax25cmp(&rose->source_call, &null_ax25_address) &&
s->state == TCP_LISTEN) { s->state == TCP_LISTEN) {
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
return s; return s;
} }
} }
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
return NULL; return NULL;
} }
...@@ -302,19 +297,18 @@ static struct sock *rose_find_listener(rose_address *addr, ax25_address *call) ...@@ -302,19 +297,18 @@ static struct sock *rose_find_listener(rose_address *addr, ax25_address *call)
*/ */
struct sock *rose_find_socket(unsigned int lci, struct rose_neigh *neigh) struct sock *rose_find_socket(unsigned int lci, struct rose_neigh *neigh)
{ {
unsigned long flags;
struct sock *s; struct sock *s;
spin_lock_irqsave(&rose_list_lock, flags); spin_lock_bh(&rose_list_lock);
for (s = rose_list; s != NULL; s = s->next) { for (s = rose_list; s != NULL; s = s->next) {
rose_cb *rose = rose_sk(s); rose_cb *rose = rose_sk(s);
if (rose->lci == lci && rose->neighbour == neigh) { if (rose->lci == lci && rose->neighbour == neigh) {
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
return s; return s;
} }
} }
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
return NULL; return NULL;
} }
...@@ -1362,7 +1356,6 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1362,7 +1356,6 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
static int rose_get_info(char *buffer, char **start, off_t offset, int length) static int rose_get_info(char *buffer, char **start, off_t offset, int length)
{ {
unsigned long flags;
struct sock *s; struct sock *s;
struct net_device *dev; struct net_device *dev;
const char *devname, *callsign; const char *devname, *callsign;
...@@ -1370,7 +1363,7 @@ static int rose_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -1370,7 +1363,7 @@ static int rose_get_info(char *buffer, char **start, off_t offset, int length)
off_t pos = 0; off_t pos = 0;
off_t begin = 0; off_t begin = 0;
spin_lock_irqsave(&rose_list_lock, flags); spin_lock_bh(&rose_list_lock);
len += sprintf(buffer, "dest_addr dest_call src_addr src_call dev lci neigh st vs vr va t t1 t2 t3 hb idle Snd-Q Rcv-Q inode\n"); len += sprintf(buffer, "dest_addr dest_call src_addr src_call dev lci neigh st vs vr va t t1 t2 t3 hb idle Snd-Q Rcv-Q inode\n");
...@@ -1422,7 +1415,7 @@ static int rose_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -1422,7 +1415,7 @@ static int rose_get_info(char *buffer, char **start, off_t offset, int length)
if (pos > offset + length) if (pos > offset + length)
break; break;
} }
spin_unlock_irqrestore(&rose_list_lock, flags); spin_unlock_bh(&rose_list_lock);
*start = buffer + (offset - begin); *start = buffer + (offset - begin);
len -= (offset - begin); len -= (offset - begin);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment