Skip to contentSkip to conversation

irda_device() oops fix

PATCH In review [email protected] 1 participant 1 message Apr 12, 2005 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 23/198 irda_device() oops fix

From: Jean Tourrilhes <[email protected]>

---

 25-akpm/net/irda/irda_device.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
net/irda/irda_device.c renamed from net/irda/irda_device.c~irda_device-oops-fix +9 -2
diff -puN net/irda/irda_device.c~irda_device-oops-fix net/irda/irda_device.c
@@ -125,8 +125,15 @@ void irda_device_set_media_busy(struct n
 
 	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;

_