Commit bd6258cc authored by Jean Tourrilhes's avatar Jean Tourrilhes Committed by Linus Torvalds

[PATCH] IrNET crasher

ir257_irnet_bh.diff :
	o [CRITICA] Replace spin_lock_irqsave() with spin_lock_bh()
		to be compatible with ppp_generic locking
	o [CRITICA] Disable call to ppp_unregister_channel()
parent 5976fac2
...@@ -229,6 +229,11 @@ ...@@ -229,6 +229,11 @@
* v14 - 20.2.03 - Jean II * v14 - 20.2.03 - Jean II
* o Add discovery hint bits in the control channel. * o Add discovery hint bits in the control channel.
* o Remove obsolete MOD_INC/DEC_USE_COUNT in favor of .owner * o Remove obsolete MOD_INC/DEC_USE_COUNT in favor of .owner
*
* v15 - 7.4.03 - Jean II
* o Replace spin_lock_irqsave() with spin_lock_bh() so that we can
* use ppp_unit_number(). It's probably also better overall...
* o Disable call to ppp_unregister_channel(), because we can't do it.
*/ */
/***************************** INCLUDES *****************************/ /***************************** INCLUDES *****************************/
...@@ -276,6 +281,7 @@ ...@@ -276,6 +281,7 @@
#undef CONNECT_INDIC_KICK /* Might mess IrDA, not needed */ #undef CONNECT_INDIC_KICK /* Might mess IrDA, not needed */
#undef FAIL_SEND_DISCONNECT /* Might mess IrDA, not needed */ #undef FAIL_SEND_DISCONNECT /* Might mess IrDA, not needed */
#undef PASS_CONNECT_PACKETS /* Not needed ? Safe */ #undef PASS_CONNECT_PACKETS /* Not needed ? Safe */
#undef MISSING_PPP_API /* Stuff I wish I could do */
/* PPP side of the business */ /* PPP side of the business */
#define BLOCK_WHEN_CONNECT /* Block packets when connecting */ #define BLOCK_WHEN_CONNECT /* Block packets when connecting */
......
...@@ -31,7 +31,6 @@ irnet_post_event(irnet_socket * ap, ...@@ -31,7 +31,6 @@ irnet_post_event(irnet_socket * ap,
char * name, char * name,
__u16 hints) __u16 hints)
{ {
unsigned long flags; /* For spinlock */
int index; /* In the log */ int index; /* In the log */
DENTER(CTRL_TRACE, "(ap=0x%X, event=%d, daddr=%08x, name=``%s'')\n", DENTER(CTRL_TRACE, "(ap=0x%X, event=%d, daddr=%08x, name=``%s'')\n",
...@@ -41,7 +40,7 @@ irnet_post_event(irnet_socket * ap, ...@@ -41,7 +40,7 @@ irnet_post_event(irnet_socket * ap,
* Note : as we are the only event producer, we only need to exclude * Note : as we are the only event producer, we only need to exclude
* ourself when touching the log, which is nice and easy. * ourself when touching the log, which is nice and easy.
*/ */
spin_lock_irqsave(&irnet_events.spinlock, flags); spin_lock_bh(&irnet_events.spinlock);
/* Copy the event in the log */ /* Copy the event in the log */
index = irnet_events.index; index = irnet_events.index;
...@@ -69,7 +68,7 @@ irnet_post_event(irnet_socket * ap, ...@@ -69,7 +68,7 @@ irnet_post_event(irnet_socket * ap,
DEBUG(CTRL_INFO, "New event index is %d\n", irnet_events.index); DEBUG(CTRL_INFO, "New event index is %d\n", irnet_events.index);
/* Spin lock end */ /* Spin lock end */
spin_unlock_irqrestore(&irnet_events.spinlock, flags); spin_unlock_bh(&irnet_events.spinlock);
/* Now : wake up everybody waiting for events... */ /* Now : wake up everybody waiting for events... */
wake_up_interruptible_all(&irnet_events.rwait); wake_up_interruptible_all(&irnet_events.rwait);
...@@ -536,10 +535,9 @@ irda_irnet_connect(irnet_socket * self) ...@@ -536,10 +535,9 @@ irda_irnet_connect(irnet_socket * self)
* Can't re-insert (MUST remove first) so check for that... */ * Can't re-insert (MUST remove first) so check for that... */
if((irnet_server.running) && (self->q.q_next == NULL)) if((irnet_server.running) && (self->q.q_next == NULL))
{ {
unsigned long flags; spin_lock_bh(&irnet_server.spinlock);
spin_lock_irqsave(&irnet_server.spinlock, flags);
hashbin_insert(irnet_server.list, (irda_queue_t *) self, 0, self->rname); hashbin_insert(irnet_server.list, (irda_queue_t *) self, 0, self->rname);
spin_unlock_irqrestore(&irnet_server.spinlock, flags); spin_unlock_bh(&irnet_server.spinlock);
DEBUG(IRDA_SOCK_INFO, "Inserted ``%s'' in hashbin...\n", self->rname); DEBUG(IRDA_SOCK_INFO, "Inserted ``%s'' in hashbin...\n", self->rname);
} }
...@@ -596,12 +594,11 @@ irda_irnet_destroy(irnet_socket * self) ...@@ -596,12 +594,11 @@ irda_irnet_destroy(irnet_socket * self)
if((irnet_server.running) && (self->q.q_next != NULL)) if((irnet_server.running) && (self->q.q_next != NULL))
{ {
struct irnet_socket * entry; struct irnet_socket * entry;
unsigned long flags;
DEBUG(IRDA_SOCK_INFO, "Removing from hash..\n"); DEBUG(IRDA_SOCK_INFO, "Removing from hash..\n");
spin_lock_irqsave(&irnet_server.spinlock, flags); spin_lock_bh(&irnet_server.spinlock);
entry = hashbin_remove_this(irnet_server.list, (irda_queue_t *) self); entry = hashbin_remove_this(irnet_server.list, (irda_queue_t *) self);
self->q.q_next = NULL; self->q.q_next = NULL;
spin_unlock_irqrestore(&irnet_server.spinlock, flags); spin_unlock_bh(&irnet_server.spinlock);
DASSERT(entry == self, , IRDA_SOCK_ERROR, "Can't remove from hash.\n"); DASSERT(entry == self, , IRDA_SOCK_ERROR, "Can't remove from hash.\n");
} }
...@@ -723,7 +720,6 @@ static inline irnet_socket * ...@@ -723,7 +720,6 @@ static inline irnet_socket *
irnet_find_socket(irnet_socket * self) irnet_find_socket(irnet_socket * self)
{ {
irnet_socket * new = (irnet_socket *) NULL; irnet_socket * new = (irnet_socket *) NULL;
unsigned long flags;
int err; int err;
DENTER(IRDA_SERV_TRACE, "(self=0x%X)\n", (unsigned int) self); DENTER(IRDA_SERV_TRACE, "(self=0x%X)\n", (unsigned int) self);
...@@ -736,7 +732,7 @@ irnet_find_socket(irnet_socket * self) ...@@ -736,7 +732,7 @@ irnet_find_socket(irnet_socket * self)
err = irnet_daddr_to_dname(self); err = irnet_daddr_to_dname(self);
/* Protect access to the instance list */ /* Protect access to the instance list */
spin_lock_irqsave(&irnet_server.spinlock, flags); spin_lock_bh(&irnet_server.spinlock);
/* So now, try to get an socket having specifically /* So now, try to get an socket having specifically
* requested that nickname */ * requested that nickname */
...@@ -790,7 +786,7 @@ irnet_find_socket(irnet_socket * self) ...@@ -790,7 +786,7 @@ irnet_find_socket(irnet_socket * self)
} }
/* Spin lock end */ /* Spin lock end */
spin_unlock_irqrestore(&irnet_server.spinlock, flags); spin_unlock_bh(&irnet_server.spinlock);
DEXIT(IRDA_SERV_TRACE, " - new = 0x%X\n", (unsigned int) new); DEXIT(IRDA_SERV_TRACE, " - new = 0x%X\n", (unsigned int) new);
return new; return new;
...@@ -1135,10 +1131,15 @@ irnet_disconnect_indication(void * instance, ...@@ -1135,10 +1131,15 @@ irnet_disconnect_indication(void * instance,
{ {
if(test_open) if(test_open)
{ {
#ifdef MISSING_PPP_API
/* ppp_unregister_channel() wants a user context, which we
* are guaranteed to NOT have here. What are we supposed
* to do here ? Jean II */
/* If we were connected, cleanup & close the PPP channel, /* If we were connected, cleanup & close the PPP channel,
* which will kill pppd (hangup) and the rest */ * which will kill pppd (hangup) and the rest */
ppp_unregister_channel(&self->chan); ppp_unregister_channel(&self->chan);
self->ppp_open = 0; self->ppp_open = 0;
#endif
} }
else else
{ {
...@@ -1711,7 +1712,6 @@ irnet_proc_read(char * buf, ...@@ -1711,7 +1712,6 @@ irnet_proc_read(char * buf,
{ {
irnet_socket * self; irnet_socket * self;
char * state; char * state;
unsigned long flags;
int i = 0; int i = 0;
len = 0; len = 0;
...@@ -1728,7 +1728,7 @@ irnet_proc_read(char * buf, ...@@ -1728,7 +1728,7 @@ irnet_proc_read(char * buf,
return len; return len;
/* Protect access to the instance list */ /* Protect access to the instance list */
spin_lock_irqsave(&irnet_server.spinlock, flags); spin_lock_bh(&irnet_server.spinlock);
/* Get the sockets one by one... */ /* Get the sockets one by one... */
self = (irnet_socket *) hashbin_get_first(irnet_server.list); self = (irnet_socket *) hashbin_get_first(irnet_server.list);
...@@ -1780,7 +1780,7 @@ irnet_proc_read(char * buf, ...@@ -1780,7 +1780,7 @@ irnet_proc_read(char * buf,
} }
/* Spin lock end */ /* Spin lock end */
spin_unlock_irqrestore(&irnet_server.spinlock, flags); spin_unlock_bh(&irnet_server.spinlock);
return len; return len;
} }
......
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