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)
static void ax25_remove_socket(ax25_cb *ax25)
{
ax25_cb *s;
unsigned long flags;
spin_lock_irqsave(&ax25_list_lock, flags);
spin_lock_bh(&ax25_list_lock);
if ((s = ax25_list) == ax25) {
ax25_list = s->next;
spin_unlock_irqrestore(&ax25_list_lock, flags);
spin_unlock_bh(&ax25_list_lock);
return;
}
while (s != NULL && s->next != NULL) {
if (s->next == ax25) {
s->next = ax25->next;
spin_unlock_irqrestore(&ax25_list_lock, flags);
spin_unlock_bh(&ax25_list_lock);
return;
}
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)
*/
static void ax25_kill_by_device(struct net_device *dev)
{
unsigned long flags;
ax25_dev *ax25_dev;
ax25_cb *s;
if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)
return;
spin_lock_irqsave(&ax25_list_lock, flags);
spin_lock_bh(&ax25_list_lock);
for (s = ax25_list; s != NULL; s = s->next) {
if (s->ax25_dev == ax25_dev) {
s->ax25_dev = NULL;
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,
*/
void ax25_insert_socket(ax25_cb *ax25)
{
unsigned long flags;
spin_lock_irqsave(&ax25_list_lock, flags);
spin_lock_bh(&ax25_list_lock);
ax25->next = ax25_list;
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)
struct sock *ax25_find_listener(ax25_address *addr, int digi,
struct net_device *dev, int type)
{
unsigned long flags;
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) {
if ((s->iamdigi && !digi) || (!s->iamdigi && digi))
continue;
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 (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;
}
}
}
spin_unlock_irqrestore(&ax25_list_lock, flags);
spin_unlock_bh(&ax25_list_lock);
return NULL;
}
......@@ -202,10 +197,9 @@ struct sock *ax25_get_socket(ax25_address *my_addr, ax25_address *dest_addr,
int type)
{
struct sock *sk = NULL;
unsigned long flags;
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) {
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;
......@@ -215,7 +209,7 @@ struct sock *ax25_get_socket(ax25_address *my_addr, ax25_address *dest_addr,
}
out:
spin_unlock_irqrestore(&ax25_list_lock, flags);
spin_unlock_bh(&ax25_list_lock);
return NULL;
}
......@@ -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_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) {
if (s->sk != NULL && s->sk->type != SOCK_SEQPACKET)
continue;
......@@ -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)
continue;
}
spin_unlock_irqrestore(&ax25_list_lock, flags);
spin_unlock_bh(&ax25_list_lock);
return s;
}
}
spin_unlock_irqrestore(&ax25_list_lock, flags);
spin_unlock_bh(&ax25_list_lock);
return NULL;
}
......@@ -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)
{
unsigned long flags;
struct sock *sk = NULL;
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) {
if (s->sk != NULL && ax25cmp(&s->source_addr, addr) == 0 &&
s->sk->type == SOCK_RAW) {
......@@ -274,7 +266,7 @@ struct sock *ax25_addr_match(ax25_address *addr)
break;
}
}
spin_unlock_irqrestore(&ax25_list_lock, flags);
spin_unlock_bh(&ax25_list_lock);
return sk;
}
......@@ -320,7 +312,6 @@ static void ax25_destroy_timer(unsigned long data)
void ax25_destroy_socket(ax25_cb *ax25)
{
struct sk_buff *skb;
unsigned long flags;
ax25_remove_socket(ax25);
......@@ -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)
{
unsigned long flags;
ax25_cb *ax25;
int k;
int len = 0;
off_t pos = 0;
off_t begin = 0;
spin_lock_irqsave(&ax25_list_lock, flags);
spin_lock_bh(&ax25_list_lock);
/*
* New format:
......@@ -1909,7 +1899,7 @@ static int ax25_get_info(char *buffer, char **start, off_t offset, int length)
break;
}
spin_unlock_irqrestore(&ax25_list_lock, flags);
spin_unlock_bh(&ax25_list_lock);
*start = buffer + (offset - begin);
len -= (offset - begin);
......
......@@ -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, *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)
if (ax25_dev->dev == dev) {
res = ax25_dev;
break;
}
spin_unlock_irqrestore(&ax25_dev_lock, flags);
spin_unlock_bh(&ax25_dev_lock);
return res;
}
......@@ -53,14 +52,13 @@ ax25_dev *ax25_dev_ax25dev(struct net_device *dev)
ax25_dev *ax25_addr_ax25dev(ax25_address *addr)
{
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)
if (ax25cmp(addr, (ax25_address *)ax25_dev->dev->dev_addr) == 0) {
res = ax25_dev;
}
spin_unlock_irqrestore(&ax25_dev_lock, flags);
spin_unlock_bh(&ax25_dev_lock);
return res;
}
......@@ -72,7 +70,6 @@ ax25_dev *ax25_addr_ax25dev(ax25_address *addr)
void ax25_dev_device_up(struct net_device *dev)
{
ax25_dev *ax25_dev;
unsigned long flags;
if ((ax25_dev = kmalloc(sizeof(*ax25_dev), GFP_ATOMIC)) == NULL) {
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)
ax25_dev->values[AX25_VALUES_PROTOCOL] = AX25_DEF_PROTOCOL;
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_list = ax25_dev;
spin_unlock_irqrestore(&ax25_dev_lock, flags);
spin_unlock_bh(&ax25_dev_lock);
ax25_register_sysctl();
}
......@@ -112,14 +109,13 @@ void ax25_dev_device_up(struct net_device *dev)
void ax25_dev_device_down(struct net_device *dev)
{
ax25_dev *s, *ax25_dev;
unsigned long flags;
if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)
return;
ax25_unregister_sysctl();
spin_lock_irqsave(&ax25_dev_lock, flags);
spin_lock_bh(&ax25_dev_lock);
#ifdef CONFIG_AX25_DAMA_SLAVE
ax25_ds_del_timer(ax25_dev);
......@@ -134,7 +130,7 @@ void ax25_dev_device_down(struct net_device *dev)
if ((s = ax25_dev_list) == ax25_dev) {
ax25_dev_list = s->next;
spin_unlock_irqrestore(&ax25_dev_lock, flags);
spin_unlock_bh(&ax25_dev_lock);
kfree(ax25_dev);
ax25_register_sysctl();
return;
......@@ -143,7 +139,7 @@ void ax25_dev_device_down(struct net_device *dev)
while (s != NULL && s->next != NULL) {
if (s->next == ax25_dev) {
s->next = ax25_dev->next;
spin_unlock_irqrestore(&ax25_dev_lock, flags);
spin_unlock_bh(&ax25_dev_lock);
kfree(ax25_dev);
ax25_register_sysctl();
return;
......@@ -151,7 +147,7 @@ void ax25_dev_device_down(struct net_device *dev)
s = s->next;
}
spin_unlock_irqrestore(&ax25_dev_lock, flags);
spin_unlock_bh(&ax25_dev_lock);
ax25_register_sysctl();
}
......@@ -204,9 +200,8 @@ struct net_device *ax25_fwd_dev(struct net_device *dev)
void __exit ax25_dev_free(void)
{
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;
while (ax25_dev != NULL) {
s = ax25_dev;
......@@ -215,5 +210,5 @@ void __exit ax25_dev_free(void)
kfree(s);
}
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)
*/
void ax25_ds_enquiry_response(ax25_cb *ax25)
{
unsigned long flags;
ax25_cb *ax25o;
/* Please note that neither DK4EGs nor DG2FEFs
......@@ -80,7 +79,7 @@ void ax25_ds_enquiry_response(ax25_cb *ax25)
ax25_start_t3timer(ax25);
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) {
if (ax25o == ax25)
continue;
......@@ -106,7 +105,7 @@ void ax25_ds_enquiry_response(ax25_cb *ax25)
if (ax25o->state != AX25_STATE_0)
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)
......@@ -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)
{
unsigned long flags;
ax25_cb *ax25;
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)
if (ax25->ax25_dev == ax25_dev && (ax25->condition & AX25_COND_DAMA_MODE) && ax25->state > AX25_STATE_1) {
res = 1;
break;
}
spin_unlock_irqrestore(&ax25_list_lock, flags);
spin_unlock_bh(&ax25_list_lock);
return res;
}
......
......@@ -73,7 +73,6 @@ void ax25_ds_set_timer(ax25_dev *ax25_dev)
static void ax25_ds_timeout(unsigned long arg)
{
ax25_dev *ax25_dev = (struct ax25_dev *) arg;
unsigned long flags;
ax25_cb *ax25;
if (ax25_dev == NULL || !ax25_dev->dama.slave)
......@@ -84,7 +83,7 @@ static void ax25_ds_timeout(unsigned long arg)
return;
}
spin_lock_irqsave(&ax25_list_lock, flags);
spin_lock_bh(&ax25_list_lock);
for (ax25=ax25_list; ax25 != NULL; ax25 = ax25->next) {
if (ax25->ax25_dev != ax25_dev || !(ax25->condition & AX25_COND_DAMA_MODE))
continue;
......@@ -92,7 +91,7 @@ static void ax25_ds_timeout(unsigned long arg)
ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND);
ax25_disconnect(ax25, ETIMEDOUT);
}
spin_unlock_irqrestore(&ax25_list_lock, flags);
spin_unlock_bh(&ax25_list_lock);
ax25_dev_dama_off(ax25_dev);
}
......
......@@ -109,17 +109,16 @@ void ax25_protocol_release(unsigned int pid)
int ax25_linkfail_register(void (*func)(ax25_cb *, int))
{
struct linkfail_struct *linkfail;
unsigned long flags;
if ((linkfail = kmalloc(sizeof(*linkfail), GFP_ATOMIC)) == NULL)
return 0;
linkfail->func = func;
spin_lock_irqsave(&linkfail_lock, flags);
spin_lock_bh(&linkfail_lock);
linkfail->next = linkfail_list;
linkfail_list = linkfail;
spin_unlock_irqrestore(&linkfail_lock, flags);
spin_unlock_bh(&linkfail_lock);
return 1;
}
......@@ -127,16 +126,15 @@ int ax25_linkfail_register(void (*func)(ax25_cb *, int))
void ax25_linkfail_release(void (*func)(ax25_cb *, int))
{
struct linkfail_struct *s, *linkfail;
unsigned long flags;
spin_lock_irqsave(&linkfail_lock, flags);
spin_lock_bh(&linkfail_lock);
linkfail = linkfail_list;
if (linkfail == NULL)
return;
if (linkfail->func == func) {
linkfail_list = linkfail->next;
spin_unlock_irqrestore(&linkfail_lock, flags);
spin_unlock_bh(&linkfail_lock);
kfree(linkfail);
return;
}
......@@ -145,20 +143,19 @@ void ax25_linkfail_release(void (*func)(ax25_cb *, int))
if (linkfail->next->func == func) {
s = linkfail->next;
linkfail->next = linkfail->next->next;
spin_unlock_irqrestore(&linkfail_lock, flags);
spin_unlock_bh(&linkfail_lock);
kfree(s);
return;
}
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)
{
struct listen_struct *listen;
unsigned long flags;
if (ax25_listen_mine(callsign, dev))
return 0;
......@@ -169,10 +166,10 @@ int ax25_listen_register(ax25_address *callsign, struct net_device *dev)
listen->callsign = *callsign;
listen->dev = dev;
spin_lock_irqsave(&listen_lock, flags);
spin_lock_bh(&listen_lock);
listen->next = listen_list;
listen_list = listen;
spin_unlock_irqrestore(&listen_lock, flags);
spin_unlock_bh(&listen_lock);
return 1;
}
......@@ -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)
{
struct listen_struct *s, *listen;
unsigned long flags;
spin_lock_irqsave(&listen_lock, flags);
spin_lock_bh(&listen_lock);
listen = listen_list;
if (listen == NULL)
return;
if (ax25cmp(&listen->callsign, callsign) == 0 && listen->dev == dev) {
listen_list = listen->next;
spin_unlock_irqrestore(&listen_lock, flags);
spin_unlock_bh(&listen_lock);
kfree(listen);
return;
}
......@@ -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) {
s = listen->next;
listen->next = listen->next->next;
spin_unlock_irqrestore(&listen_lock, flags);
spin_unlock_bh(&listen_lock);
kfree(s);
return;
}
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 *)
......@@ -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)
{
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)
if (ax25cmp(&listen->callsign, callsign) == 0 && (listen->dev == dev || listen->dev == NULL))
return 1;
spin_unlock_irqrestore(&listen_lock, flags);
spin_unlock_bh(&listen_lock);
return 0;
}
......@@ -241,12 +236,11 @@ int ax25_listen_mine(ax25_address *callsign, struct net_device *dev)
void ax25_link_failed(ax25_cb *ax25, int reason)
{
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)
(linkfail->func)(ax25, reason);
spin_unlock_irqrestore(&linkfail_lock, flags);
spin_unlock_bh(&linkfail_lock);
}
int ax25_protocol_is_registered(unsigned int pid)
......
......@@ -115,7 +115,6 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
struct sk_buff *skbn;
unsigned char *p;
int frontlen, len, fragno, ka9qfrag, first = 1;
long flags;
if ((skb->len - 1) > paclen) {
if (*skb->data == AX25_P_TEXT) {
......@@ -132,9 +131,9 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
frontlen = skb_headroom(skb); /* Address space + CTRL */
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) {
spin_unlock_irqrestore(&ax25_frag_lock, flags);
spin_unlock_bh(&ax25_frag_lock);
printk(KERN_CRIT "AX.25: ax25_output - out of memory\n");
return;
}
......@@ -142,7 +141,7 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
if (skb->sk != NULL)
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;
......
......@@ -104,11 +104,10 @@ static const ctl_table ax25_param_table[] = {
void ax25_register_sysctl(void)
{
unsigned long flags;
ax25_dev *ax25_dev;
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)
ax25_table_size += sizeof(ctl_table);
......@@ -123,7 +122,7 @@ void ax25_register_sysctl(void)
while (n--)
kfree(ax25_table[n].child);
kfree(ax25_table);
spin_unlock_irqrestore(&ax25_dev_lock, flags);
spin_unlock_bh(&ax25_dev_lock);
return;
}
memcpy(child, ax25_param_table, sizeof(ax25_param_table));
......@@ -149,7 +148,7 @@ void ax25_register_sysctl(void)
n++;
}
spin_unlock_irqrestore(&ax25_dev_lock, flags);
spin_unlock_bh(&ax25_dev_lock);
ax25_dir_table[0].child = ax25_table;
......
......@@ -99,27 +99,26 @@ decmod: MOD_DEC_USE_COUNT;
static void nr_remove_socket(struct sock *sk)
{
struct sock *s;
unsigned long flags;
spin_lock_irqsave(&nr_list_lock, flags);
spin_lock_bh(&nr_list_lock);
if ((s = nr_list) == sk) {
nr_list = s->next;
spin_unlock_irqrestore(&nr_list_lock, flags);
spin_unlock_bh(&nr_list_lock);
return;
}
while (s != NULL && s->next != NULL) {
if (s->next == sk) {
s->next = sk->next;
spin_unlock_irqrestore(&nr_list_lock, flags);
spin_unlock_bh(&nr_list_lock);
return;
}
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)
*/
static void nr_kill_by_device(struct net_device *dev)
{
unsigned long flags;
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) {
if (nr_sk(s)->device == dev)
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
*/
static void nr_insert_socket(struct sock *sk)
{
unsigned long flags;
spin_lock_irqsave(&nr_list_lock, flags);
spin_lock_bh(&nr_list_lock);
sk->next = nr_list;
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)
*/
static struct sock *nr_find_listener(ax25_address *addr)
{
unsigned long flags;
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) {
if (!ax25cmp(&nr_sk(s)->source_addr, addr) &&
s->state == TCP_LISTEN) {
spin_unlock_irqrestore(&nr_list_lock, flags);
spin_unlock_bh(&nr_list_lock);
return s;
}
}
spin_unlock_irqrestore(&nr_list_lock, flags);
spin_unlock_bh(&nr_list_lock);
return NULL;
}
......@@ -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)
{
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) {
nr_cb *nr = nr_sk(s);
if (nr->my_index == index && nr->my_id == id) {
spin_unlock_irqrestore(&nr_list_lock, flags);
spin_unlock_bh(&nr_list_lock);
return s;
}
}
spin_unlock_irqrestore(&nr_list_lock, flags);
spin_unlock_bh(&nr_list_lock);
return NULL;
}
......@@ -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,
ax25_address *dest)
{
unsigned long flags;
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) {
nr_cb *nr = nr_sk(s);
if (nr->your_index == index && nr->your_id == id &&
!ax25cmp(&nr->dest_addr, dest)) {
spin_unlock_irqrestore(&nr_list_lock, flags);
spin_unlock_bh(&nr_list_lock);
return s;
}
}
spin_unlock_irqrestore(&nr_list_lock, flags);
spin_unlock_bh(&nr_list_lock);
return NULL;
}
......@@ -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)
{
unsigned long flags;
struct sock *s;
struct net_device *dev;
const char *devname;
......@@ -1172,7 +1164,7 @@ static int nr_get_info(char *buffer, char **start, off_t offset, int length)
off_t pos = 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");
......@@ -1225,7 +1217,7 @@ static int nr_get_info(char *buffer, char **start, off_t offset, int length)
break;
}
spin_unlock_irqrestore(&nr_list_lock, flags);
spin_unlock_bh(&nr_list_lock);
*start = buffer + (offset - begin);
len -= (offset - begin);
......
......@@ -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_neigh *nr_neigh;
struct nr_route nr_route;
unsigned long flags;
int i, found;
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
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_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)
......@@ -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].neighbour = nr_neigh;
spin_lock_irqsave(&nr_node_lock, flags);
spin_lock_bh(&nr_node_lock);
nr_node->next = nr_node_list;
nr_node_list = nr_node;
spin_unlock_irqrestore(&nr_node_lock, flags);
spin_unlock_bh(&nr_node_lock);
nr_neigh->count++;
......@@ -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)
{
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) {
nr_node_list = nr_node->next;
spin_unlock_irqrestore(&nr_node_lock, flags);
spin_unlock_bh(&nr_node_lock);
kfree(nr_node);
return;
}
......@@ -263,7 +261,7 @@ static void nr_remove_node(struct nr_node *nr_node)
while (s != NULL && s->next != NULL) {
if (s->next == nr_node) {
s->next = nr_node->next;
spin_unlock_irqrestore(&nr_node_lock, flags);
spin_unlock_bh(&nr_node_lock);
kfree(nr_node);
return;
}
......@@ -271,18 +269,17 @@ static void nr_remove_node(struct nr_node *nr_node)
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)
{
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) {
nr_neigh_list = nr_neigh->next;
spin_unlock_irqrestore(&nr_neigh_lock, flags);
spin_unlock_bh(&nr_neigh_lock);
if (nr_neigh->digipeat != NULL)
kfree(nr_neigh->digipeat);
kfree(nr_neigh);
......@@ -292,7 +289,7 @@ static void nr_remove_neigh(struct nr_neigh *nr_neigh)
while (s != NULL && s->next != NULL) {
if (s->next == nr_neigh) {
s->next = nr_neigh->next;
spin_unlock_irqrestore(&nr_neigh_lock, flags);
spin_unlock_bh(&nr_neigh_lock);
if (nr_neigh->digipeat != NULL)
kfree(nr_neigh->digipeat);
kfree(nr_neigh);
......@@ -301,7 +298,7 @@ static void nr_remove_neigh(struct nr_neigh *nr_neigh)
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
static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct net_device *dev, unsigned int quality)
{
struct nr_neigh *nr_neigh;
unsigned long flags;
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) {
......@@ -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));
}
spin_lock_irqsave(&nr_neigh_lock, flags);
spin_lock_bh(&nr_neigh_lock);
nr_neigh->next = nr_neigh_list;
nr_neigh_list = nr_neigh;
spin_unlock_irqrestore(&nr_neigh_lock, flags);
spin_unlock_bh(&nr_neigh_lock);
return 0;
}
......@@ -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)
{
struct nr_node *nr_node;
unsigned long flags;
int len = 0;
off_t pos = 0;
off_t begin = 0;
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");
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)
if (pos > offset + length)
break;
}
spin_unlock_irqrestore(&nr_node_lock, flags);
spin_unlock_bh(&nr_node_lock);
*start = buffer + (offset - begin);
len -= (offset - begin);
......@@ -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)
{
struct nr_neigh *nr_neigh;
unsigned long flags;
int len = 0;
off_t pos = 0;
off_t begin = 0;
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");
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)
break;
}
spin_unlock_irqrestore(&nr_neigh_lock, flags);
spin_unlock_bh(&nr_neigh_lock);
*start = buffer + (offset - begin);
len -= (offset - begin);
......
......@@ -160,25 +160,24 @@ decmod: MOD_DEC_USE_COUNT;
static void rose_remove_socket(struct sock *sk)
{
struct sock *s;
unsigned long flags;
spin_lock_irqsave(&rose_list_lock, flags);
spin_lock_bh(&rose_list_lock);
if ((s = rose_list) == sk) {
rose_list = s->next;
spin_unlock_irqrestore(&rose_list_lock, flags);
spin_unlock_bh(&rose_list_lock);
return;
}
while (s != NULL && s->next != NULL) {
if (s->next == sk) {
s->next = sk->next;
spin_unlock_irqrestore(&rose_list_lock, flags);
spin_unlock_bh(&rose_list_lock);
return;
}
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)
*/
void rose_kill_by_neigh(struct rose_neigh *neigh)
{
unsigned long flags;
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) {
rose_cb *rose = rose_sk(s);
......@@ -200,7 +198,7 @@ void rose_kill_by_neigh(struct rose_neigh *neigh)
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)
*/
static void rose_kill_by_device(struct net_device *dev)
{
unsigned long flags;
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) {
rose_cb *rose = rose_sk(s);
......@@ -221,7 +218,7 @@ static void rose_kill_by_device(struct net_device *dev)
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,
*/
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;
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)
*/
static struct sock *rose_find_listener(rose_address *addr, ax25_address *call)
{
unsigned long flags;
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) {
rose_cb *rose = rose_sk(s);
if (!rosecmp(&rose->source_addr, addr) &&
!ax25cmp(&rose->source_call, call) &&
!rose->source_ndigis && s->state == TCP_LISTEN) {
spin_unlock_irqrestore(&rose_list_lock, flags);
spin_unlock_bh(&rose_list_lock);
return s;
}
}
......@@ -288,11 +283,11 @@ static struct sock *rose_find_listener(rose_address *addr, ax25_address *call)
if (!rosecmp(&rose->source_addr, addr) &&
!ax25cmp(&rose->source_call, &null_ax25_address) &&
s->state == TCP_LISTEN) {
spin_unlock_irqrestore(&rose_list_lock, flags);
spin_unlock_bh(&rose_list_lock);
return s;
}
}
spin_unlock_irqrestore(&rose_list_lock, flags);
spin_unlock_bh(&rose_list_lock);
return NULL;
}
......@@ -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)
{
unsigned long flags;
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) {
rose_cb *rose = rose_sk(s);
if (rose->lci == lci && rose->neighbour == neigh) {
spin_unlock_irqrestore(&rose_list_lock, flags);
spin_unlock_bh(&rose_list_lock);
return s;
}
}
spin_unlock_irqrestore(&rose_list_lock, flags);
spin_unlock_bh(&rose_list_lock);
return NULL;
}
......@@ -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)
{
unsigned long flags;
struct sock *s;
struct net_device *dev;
const char *devname, *callsign;
......@@ -1370,7 +1363,7 @@ static int rose_get_info(char *buffer, char **start, off_t offset, int length)
off_t pos = 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");
......@@ -1422,7 +1415,7 @@ static int rose_get_info(char *buffer, char **start, off_t offset, int length)
if (pos > offset + length)
break;
}
spin_unlock_irqrestore(&rose_list_lock, flags);
spin_unlock_bh(&rose_list_lock);
*start = buffer + (offset - begin);
len -= (offset - begin);
......
......@@ -58,11 +58,10 @@ static int rose_add_node(struct rose_route_struct *rose_route,
{
struct rose_node *rose_node, *rose_tmpn, *rose_tmpp;
struct rose_neigh *rose_neigh;
unsigned long flags;
int i, res = 0;
spin_lock_irqsave(&rose_node_list_lock, flags);
spin_lock_irqsave(&rose_neigh_list_lock, flags);
spin_lock_bh(&rose_node_list_lock);
spin_lock_bh(&rose_neigh_list_lock);
rose_node = rose_node_list;
while (rose_node != NULL) {
......@@ -193,8 +192,8 @@ static int rose_add_node(struct rose_route_struct *rose_route,
}
out:
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_irqrestore(&rose_node_list_lock, flags);
spin_unlock_bh(&rose_neigh_list_lock);
spin_unlock_bh(&rose_node_list_lock);
return res;
}
......@@ -204,10 +203,9 @@ static int rose_add_node(struct rose_route_struct *rose_route,
*/
static void rose_remove_node(struct rose_node *rose_node)
{
unsigned long flags;
struct rose_node *s;
spin_lock_irqsave(&rose_node_list_lock, flags);
spin_lock_bh(&rose_node_list_lock);
if ((s = rose_node_list) == rose_node) {
rose_node_list = rose_node->next;
kfree(rose_node);
......@@ -231,18 +229,17 @@ static void rose_remove_node(struct rose_node *rose_node)
static void rose_remove_neigh(struct rose_neigh *rose_neigh)
{
struct rose_neigh *s;
unsigned long flags;
rose_stop_ftimer(rose_neigh);
rose_stop_t0timer(rose_neigh);
skb_queue_purge(&rose_neigh->queue);
spin_lock_irqsave(&rose_neigh_list_lock, flags);
spin_lock_bh(&rose_neigh_list_lock);
if ((s = rose_neigh_list) == rose_neigh) {
rose_neigh_list = rose_neigh->next;
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_bh(&rose_neigh_list_lock);
if (rose_neigh->digipeat != NULL)
kfree(rose_neigh->digipeat);
kfree(rose_neigh);
......@@ -252,7 +249,7 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
while (s != NULL && s->next != NULL) {
if (s->next == rose_neigh) {
s->next = rose_neigh->next;
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_bh(&rose_neigh_list_lock);
if (rose_neigh->digipeat != NULL)
kfree(rose_neigh->digipeat);
kfree(rose_neigh);
......@@ -261,7 +258,7 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
s = s->next;
}
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_bh(&rose_neigh_list_lock);
}
/*
......@@ -303,11 +300,10 @@ static int rose_del_node(struct rose_route_struct *rose_route,
{
struct rose_node *rose_node;
struct rose_neigh *rose_neigh;
unsigned long flags;
int i, err = 0;
spin_lock_irqsave(&rose_node_list_lock, flags);
spin_lock_irqsave(&rose_neigh_list_lock, flags);
spin_lock_bh(&rose_node_list_lock);
spin_lock_bh(&rose_neigh_list_lock);
rose_node = rose_node_list;
while (rose_node != NULL) {
......@@ -365,8 +361,8 @@ static int rose_del_node(struct rose_route_struct *rose_route,
err = -EINVAL;
out:
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_irqrestore(&rose_node_list_lock, flags);
spin_unlock_bh(&rose_neigh_list_lock);
spin_unlock_bh(&rose_node_list_lock);
return err;
}
......@@ -376,8 +372,6 @@ static int rose_del_node(struct rose_route_struct *rose_route,
*/
int rose_add_loopback_neigh(void)
{
unsigned long flags;
if ((rose_loopback_neigh = kmalloc(sizeof(struct rose_neigh), GFP_ATOMIC)) == NULL)
return -ENOMEM;
......@@ -397,10 +391,10 @@ int rose_add_loopback_neigh(void)
init_timer(&rose_loopback_neigh->ftimer);
init_timer(&rose_loopback_neigh->t0timer);
spin_lock_irqsave(&rose_neigh_list_lock, flags);
spin_lock_bh(&rose_neigh_list_lock);
rose_loopback_neigh->next = rose_neigh_list;
rose_neigh_list = rose_loopback_neigh;
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_bh(&rose_neigh_list_lock);
return 0;
}
......@@ -411,10 +405,9 @@ int rose_add_loopback_neigh(void)
int rose_add_loopback_node(rose_address *address)
{
struct rose_node *rose_node;
unsigned long flags;
unsigned int err = 0;
spin_lock_irqsave(&rose_node_list_lock, flags);
spin_lock_bh(&rose_node_list_lock);
rose_node = rose_node_list;
while (rose_node != NULL) {
......@@ -446,7 +439,7 @@ int rose_add_loopback_node(rose_address *address)
rose_loopback_neigh->count++;
out:
spin_unlock_irqrestore(&rose_node_list_lock, flags);
spin_unlock_bh(&rose_node_list_lock);
return 0;
}
......@@ -457,9 +450,8 @@ int rose_add_loopback_node(rose_address *address)
void rose_del_loopback_node(rose_address *address)
{
struct rose_node *rose_node;
unsigned long flags;
spin_lock_irqsave(&rose_node_list_lock, flags);
spin_lock_bh(&rose_node_list_lock);
rose_node = rose_node_list;
while (rose_node != NULL) {
......@@ -478,7 +470,7 @@ void rose_del_loopback_node(rose_address *address)
rose_loopback_neigh->count--;
out:
spin_unlock_irqrestore(&rose_node_list_lock, flags);
spin_unlock_bh(&rose_node_list_lock);
}
/*
......@@ -488,11 +480,10 @@ void rose_rt_device_down(struct net_device *dev)
{
struct rose_neigh *s, *rose_neigh;
struct rose_node *t, *rose_node;
unsigned long flags;
int i;
spin_lock_irqsave(&rose_node_list_lock, flags);
spin_lock_irqsave(&rose_neigh_list_lock, flags);
spin_lock_bh(&rose_node_list_lock);
spin_lock_bh(&rose_neigh_list_lock);
rose_neigh = rose_neigh_list;
while (rose_neigh != NULL) {
s = rose_neigh;
......@@ -529,8 +520,8 @@ void rose_rt_device_down(struct net_device *dev)
rose_remove_neigh(s);
}
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_irqrestore(&rose_node_list_lock, flags);
spin_unlock_bh(&rose_neigh_list_lock);
spin_unlock_bh(&rose_node_list_lock);
}
#if 0 /* Currently unused */
......@@ -540,9 +531,8 @@ void rose_rt_device_down(struct net_device *dev)
void rose_route_device_down(struct net_device *dev)
{
struct rose_route *s, *rose_route;
unsigned long flags;
spin_lock_irqsave(&rose_route_list_lock, flags);
spin_lock_bh(&rose_route_list_lock);
rose_route = rose_route_list;
while (rose_route != NULL) {
s = rose_route;
......@@ -551,7 +541,7 @@ void rose_route_device_down(struct net_device *dev)
if (s->neigh1->dev == dev || s->neigh2->dev == dev)
rose_remove_route(s);
}
spin_unlock_irqrestore(&rose_route_list_lock, flags);
spin_unlock_bh(&rose_route_list_lock);
}
#endif
......@@ -564,10 +554,9 @@ static int rose_clear_routes(void)
{
struct rose_neigh *s, *rose_neigh;
struct rose_node *t, *rose_node;
unsigned long flags;
spin_lock_irqsave(&rose_node_list_lock, flags);
spin_lock_irqsave(&rose_neigh_list_lock, flags);
spin_lock_bh(&rose_node_list_lock);
spin_lock_bh(&rose_neigh_list_lock);
rose_neigh = rose_neigh_list;
rose_node = rose_node_list;
......@@ -589,8 +578,8 @@ static int rose_clear_routes(void)
}
}
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_irqrestore(&rose_node_list_lock, flags);
spin_unlock_bh(&rose_neigh_list_lock);
spin_unlock_bh(&rose_node_list_lock);
return 0;
}
......@@ -686,11 +675,10 @@ struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause,
{
struct rose_neigh *res = NULL;
struct rose_node *node;
unsigned long flags;
int failed = 0;
int i;
spin_lock_irqsave(&rose_node_list_lock, flags);
spin_lock_bh(&rose_node_list_lock);
for (node = rose_node_list; node != NULL; node = node->next) {
if (rosecmpm(addr, &node->address, node->mask) == 0) {
for (i = 0; i < node->count; i++) {
......@@ -713,7 +701,7 @@ struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause,
}
out:
spin_unlock_irqrestore(&rose_node_list_lock, flags);
spin_unlock_bh(&rose_node_list_lock);
return res;
}
......@@ -766,7 +754,6 @@ int rose_rt_ioctl(unsigned int cmd, void *arg)
static void rose_del_route_by_neigh(struct rose_neigh *rose_neigh)
{
struct rose_route *rose_route, *s;
unsigned long flags;
rose_neigh->restarted = 0;
......@@ -775,7 +762,7 @@ static void rose_del_route_by_neigh(struct rose_neigh *rose_neigh)
skb_queue_purge(&rose_neigh->queue);
spin_lock_irqsave(&rose_route_list_lock, flags);
spin_lock_bh(&rose_route_list_lock);
rose_route = rose_route_list;
......@@ -803,7 +790,7 @@ static void rose_del_route_by_neigh(struct rose_neigh *rose_neigh)
rose_route = rose_route->next;
}
spin_unlock_irqrestore(&rose_route_list_lock, flags);
spin_unlock_bh(&rose_route_list_lock);
}
/*
......@@ -814,9 +801,8 @@ static void rose_del_route_by_neigh(struct rose_neigh *rose_neigh)
void rose_link_failed(ax25_cb *ax25, int reason)
{
struct rose_neigh *rose_neigh;
unsigned long flags;
spin_lock_irqsave(&rose_neigh_list_lock, flags);
spin_lock_bh(&rose_neigh_list_lock);
rose_neigh = rose_neigh_list;
while (rose_neigh != NULL) {
if (rose_neigh->ax25 == ax25)
......@@ -830,7 +816,7 @@ void rose_link_failed(ax25_cb *ax25, int reason)
rose_del_route_by_neigh(rose_neigh);
rose_kill_by_neigh(rose_neigh);
}
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_bh(&rose_neigh_list_lock);
}
/*
......@@ -863,7 +849,6 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25)
unsigned int lci, new_lci;
unsigned char cause, diagnostic;
struct net_device *dev;
unsigned long flags;
int len, res = 0;
#if 0
......@@ -876,9 +861,9 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25)
src_addr = (rose_address *)(skb->data + 9);
dest_addr = (rose_address *)(skb->data + 4);
spin_lock_irqsave(&rose_node_list_lock, flags);
spin_lock_irqsave(&rose_neigh_list_lock, flags);
spin_lock_irqsave(&rose_route_list_lock, flags);
spin_lock_bh(&rose_node_list_lock);
spin_lock_bh(&rose_neigh_list_lock);
spin_lock_bh(&rose_route_list_lock);
rose_neigh = rose_neigh_list;
while (rose_neigh != NULL) {
......@@ -1073,9 +1058,9 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25)
res = 1;
out:
spin_unlock_irqrestore(&rose_route_list_lock, flags);
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_irqrestore(&rose_node_list_lock, flags);
spin_unlock_bh(&rose_route_list_lock);
spin_unlock_bh(&rose_neigh_list_lock);
spin_unlock_bh(&rose_node_list_lock);
return res;
}
......@@ -1083,13 +1068,12 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25)
int rose_nodes_get_info(char *buffer, char **start, off_t offset, int length)
{
struct rose_node *rose_node;
unsigned long flags;
int len = 0;
off_t pos = 0;
off_t begin = 0;
int i;
spin_lock_irqsave(&rose_neigh_list_lock, flags);
spin_lock_bh(&rose_neigh_list_lock);
len += sprintf(buffer, "address mask n neigh neigh neigh\n");
......@@ -1121,7 +1105,7 @@ int rose_nodes_get_info(char *buffer, char **start, off_t offset, int length)
if (pos > offset + length)
break;
}
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_bh(&rose_neigh_list_lock);
*start = buffer + (offset - begin);
len -= (offset - begin);
......@@ -1135,13 +1119,12 @@ int rose_nodes_get_info(char *buffer, char **start, off_t offset, int length)
int rose_neigh_get_info(char *buffer, char **start, off_t offset, int length)
{
struct rose_neigh *rose_neigh;
unsigned long flags;
int len = 0;
off_t pos = 0;
off_t begin = 0;
int i;
spin_lock_irqsave(&rose_neigh_list_lock, flags);
spin_lock_bh(&rose_neigh_list_lock);
len += sprintf(buffer, "addr callsign dev count use mode restart t0 tf digipeaters\n");
......@@ -1177,7 +1160,7 @@ int rose_neigh_get_info(char *buffer, char **start, off_t offset, int length)
/* } */
}
spin_unlock_irqrestore(&rose_neigh_list_lock, flags);
spin_unlock_bh(&rose_neigh_list_lock);
*start = buffer + (offset - begin);
len -= (offset - begin);
......@@ -1191,12 +1174,11 @@ int rose_neigh_get_info(char *buffer, char **start, off_t offset, int length)
int rose_routes_get_info(char *buffer, char **start, off_t offset, int length)
{
struct rose_route *rose_route;
unsigned long flags;
int len = 0;
off_t pos = 0;
off_t begin = 0;
spin_lock_irqsave(&rose_route_list_lock, flags);
spin_lock_bh(&rose_route_list_lock);
len += sprintf(buffer, "lci address callsign neigh <-> lci address callsign neigh\n");
......@@ -1232,7 +1214,7 @@ int rose_routes_get_info(char *buffer, char **start, off_t offset, int length)
break;
}
spin_unlock_irqrestore(&rose_route_list_lock, flags);
spin_unlock_bh(&rose_route_list_lock);
*start = buffer + (offset - begin);
len -= (offset - begin);
......
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