Skip to contentSkip to conversation

IrNET status event Oops

PATCH Applied Jean Tourrilhes 2 participants 2 messages Nov 5, 2003 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IrNET status event Oops

ir2609_irnet_ppp_open_race-2.diff :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o [CRITICA] Prevent sending status event to dead/kfree sockets
o [CORRECT] Disable PPP access before deregistration PPP deregistration might sleep -> race condition

net/irda/irnet/irnet_ppp.c renamed from net/irda/irnet.d4/irnet_ppp.c +5 -3
diff -u -p linux/net/irda/irnet.d4/irnet_ppp.c linux/net/irda/irnet/irnet_ppp.c
@@ -512,8 +512,8 @@ dev_irnet_close(struct inode *	inode,
   if(ap->ppp_open)
     {
       DERROR(FS_ERROR, "Channel still registered - deregistering !\n");
-      ppp_unregister_channel(&ap->chan);
       ap->ppp_open = 0;
+      ppp_unregister_channel(&ap->chan);
     }
 
   kfree(ap);
@@ -651,10 +651,12 @@ dev_irnet_ioctl(struct inode *	inode,
 	  DEBUG(FS_INFO, "Exiting PPP discipline.\n");
 	  /* Disconnect from the generic PPP layer */
 	  if(ap->ppp_open)
-	    ppp_unregister_channel(&ap->chan);
+	    {
+	      ap->ppp_open = 0;
+	      ppp_unregister_channel(&ap->chan);
+	    }
 	  else
 	    DERROR(FS_ERROR, "Channel not registered !\n");
-	  ap->ppp_open = 0;
 	  err = 0;
 	}
       break;
net/irda/irttp.c renamed from net/irda/irttp.d4.c +5 -1
diff -u -p linux/net/irda/irttp.d4.c linux/net/irda/irttp.c
@@ -968,6 +968,10 @@ void irttp_status_indication(void *insta
 	ASSERT(self != NULL, return;);
 	ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
 
+	/* Check if client has already closed the TSAP and gone away */
+	if (self->close_pend)
+		return;
+
 	/*
 	 *  Inform service user if he has requested it
 	 */
@@ -1603,7 +1607,7 @@ void irttp_do_data_indication(struct tsa
 {
 	int err;
 
-	/* Check if client has already tried to close the TSAP */
+	/* Check if client has already closed the TSAP and gone away */
 	if (self->close_pend) {
 		dev_kfree_skb(skb);
 		return;
#1 lore raw
Quoted 5 lines · On Wed, 5 Nov 2003 11:40:42 -0800 Jean Tourrilhes <[email protected]> wrote:

ir2609_irnet_ppp_open_race-2.diff :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o [CRITICA] Prevent sending status event to dead/kfree sockets
o [CORRECT] Disable PPP access before deregistration PPP deregistration might sleep -> race condition

Applied, thanks.