From: Jean Tourrilhes Date: Sat, 16 Apr 2005 22:24:11 +0000 (-0700) Subject: [PATCH] irda_device() oops fix X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7e5c6bc0a600c49e5922591ad41ff41987f54eb4;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [PATCH] irda_device() oops fix Acked-by: "David S. Miller" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index fda299e300c..9b9bb003c5a 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c @@ -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;