mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jean Tourrilhes <jt@hpl.hp.com>
To: Michal Rokos <michal@rokos.info>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [IrDA] Oops with NULL deref in irda_device_set_media_busy
Date: Wed, 6 Apr 2005 09:49:43 -0700	[thread overview]
Message-ID: <20050406164943.GA12518@bougret.hpl.hp.com> (raw)
In-Reply-To: <200504060922.49267.michal@rokos.info>

On Wed, Apr 06, 2005 at 09:22:48AM +0200, Michal Rokos wrote:
> Hello again,
> 
> I'm gonna provide more info this time...
> 
> > > When I turn debug on, I get just
> > > Assertion failed! net/irda/irda_device.c:irda_device_set_media_busy:128
> > > self != NULL
> > >
> > > The obvious reason is that I don't have irlap module in that inits
> > > dev->atalk_ptr, so I'm getting assertion exception in irda_device.c:489.
> 
> The assertion is seen when ifup -a is called so it's when 'ifconfig irda0 up' 
> is used.

	That was the crucial bit that was missing. Now I get it. A
good night of sleep also did help.
	Patch attached.

	Jean

-----------------------------------------------------

diff -u -p linux/net/irda/irda_device.d2.c linux/net/irda/irda_device.c
--- linux/net/irda/irda_device.d2.c	Wed Apr  6 09:40:09 2005
+++ linux/net/irda/irda_device.c	Wed Apr  6 09:45:22 2005
@@ -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;

  reply	other threads:[~2005-04-06 16:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-05  9:02 Michal Rokos
2005-04-05 17:01 ` Jean Tourrilhes
2005-04-06  7:22   ` Michal Rokos
2005-04-06 16:49     ` Jean Tourrilhes [this message]
2005-04-07  6:22       ` Michal Rokos
2005-04-07 16:34         ` Jean Tourrilhes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050406164943.GA12518@bougret.hpl.hp.com \
    --to=jt@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal@rokos.info \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®