linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6 IrDA] IrNET status event Oops
@ 2003-11-05 19:40 Jean Tourrilhes
  2003-11-05 19:41 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Tourrilhes @ 2003-11-05 19:40 UTC (permalink / raw)
  To: David S. Miller, Linux kernel mailing list

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


diff -u -p linux/net/irda/irnet.d4/irnet_ppp.c linux/net/irda/irnet/irnet_ppp.c
--- linux/net/irda/irnet.d4/irnet_ppp.c	Sat Sep 27 17:50:38 2003
+++ linux/net/irda/irnet/irnet_ppp.c	Mon Oct 20 18:46:44 2003
@@ -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;
diff -u -p linux/net/irda/irttp.d4.c linux/net/irda/irttp.c
--- linux/net/irda/irttp.d4.c	Tue Oct 21 10:36:40 2003
+++ linux/net/irda/irttp.c	Tue Oct 21 11:01:52 2003
@@ -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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2.6 IrDA] IrNET status event Oops
  2003-11-05 19:40 [PATCH 2.6 IrDA] IrNET status event Oops Jean Tourrilhes
@ 2003-11-05 19:41 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2003-11-05 19:41 UTC (permalink / raw)
  To: jt; +Cc: jt, linux-kernel

On Wed, 5 Nov 2003 11:40:42 -0800
Jean Tourrilhes <jt@bougret.hpl.hp.com> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-11-05 19:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-05 19:40 [PATCH 2.6 IrDA] IrNET status event Oops Jean Tourrilhes
2003-11-05 19:41 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).