[PATCH] irda_device() oops fix
authorJean Tourrilhes <jt@hpl.hp.com>
Sat, 16 Apr 2005 22:24:11 +0000 (15:24 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 16 Apr 2005 22:24:11 +0000 (15:24 -0700)
Acked-by: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
net/irda/irda_device.c

index fda299e300c08f857e57e2b18c231afb23a5301f..9b9bb003c5a9f8c49599151202a13db7396b5493 100644 (file)
@@ -125,8 +125,15 @@ void irda_device_set_media_busy(struct net_device *dev, int status)
 
        self = (struct irlap_cb *) dev->atalk_ptr;
 
-       IRDA_ASSERT(self != NULL, return;);
-       IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
+       /* Some drivers may enable the receive interrupt before calling
+        * irlap_open(), or they may disable the receive interrupt
+        * after calling irlap_close().
+        * The IrDA stack is protected from this in irlap_driver_rcv().
+        * However, the driver calls directly the wrapper, that calls
+        * us directly. Make sure we protect ourselves.
+        * Jean II */
+       if (!self || self->magic != LAP_MAGIC)
+               return;
 
        if (status) {
                self->media_busy = TRUE;