From: Harald Welte <laforge@gnumonks.org>
To: linux-usb-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: Re: [BUG] oops while completing async USB via usbdevio
Date: Mon, 30 May 2005 23:26:41 +0200 [thread overview]
Message-ID: <20050530212641.GE25536@sunbeam.de.gnumonks.org> (raw)
In-Reply-To: <20050530194443.GA22760@sunbeam.de.gnumonks.org>
[-- Attachment #1: Type: text/plain, Size: 2586 bytes --]
On Mon, May 30, 2005 at 09:44:44PM +0200, Harald Welte wrote:
> I think there is currently no protection/locking/refcounting going on.
>
> If a process issues an URB from userspace and starts to terminate before
> the URB comes back, we run into the issue described above. This is
> because the urb saves a pointer to "current" when it is posted to the
> device, but there's no guarantee that this pointer is still valid
> afterwards.
>
> I'm not familiar with the scheduler code to decide what fix
> is the way to go. Is it sufficient to do {get,put}_task_struct() from
> the usb code?
mh. it appears like it's sighand which disappears, not the task itself.
I've tried the following patch:
Index: linux-2.6.12-rc5/kernel/signal.c
===================================================================
--- linux-2.6.12-rc5.orig/kernel/signal.c 2005-05-30 18:23:55.000000000 +0200
+++ linux-2.6.12-rc5/kernel/signal.c 2005-05-30 23:20:49.000000000 +0200
@@ -1258,6 +1258,15 @@
if (!valid_signal(sig))
return -EINVAL;
+ if (!p) {
+ printk("%s p == NULL\n");
+ return -EINVAL;
+ }
+ if (!p->sighand) {
+ printk("%s:%u p->sighand == NULL\n", __FUNCTION__, p->pid);
+ return -EINVAL;
+ }
+
/*
* We need the tasklist lock even for the specific
* thread case (when we don't need to follow the group
and it prints "p->sighand == NULL" every time I exit a program while
using the usbdevio based driver.
consequently, the following patch 'fixed' the problem. Please do not
consider this as a real fix, since there's certainly still a race
condition left. Please use it as a hint to correctly fix the problem.
Index: linux-2.6.12-rc5/drivers/usb/core/devio.c
===================================================================
--- linux-2.6.12-rc5.orig/drivers/usb/core/devio.c 2005-05-26 15:49:57.000000000 +0200
+++ linux-2.6.12-rc5/drivers/usb/core/devio.c 2005-05-30 23:21:06.000000000 +0200
@@ -283,7 +283,8 @@
sinfo.si_errno = as->urb->status;
sinfo.si_code = SI_ASYNCIO;
sinfo.si_addr = as->userurb;
- send_sig_info(as->signr, &sinfo, as->task);
+ if (as->task && as->task->sighand)
+ send_sig_info(as->signr, &sinfo, as->task);
}
wake_up(&ps->wait);
}
Thanks,
--
- Harald Welte <laforge@gnumonks.org> http://gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2005-05-30 21:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-30 19:44 Harald Welte
2005-05-30 21:26 ` Harald Welte [this message]
2005-05-30 22:55 ` [linux-usb-devel] " David Brownell
2005-05-30 23:09 ` Oliver Neukum
2005-05-30 23:12 ` David Brownell
2005-05-31 8:04 ` Harald Welte
2005-05-31 8:48 ` Harald Welte
2005-05-31 11:45 ` Oliver Neukum
2005-05-31 18:53 ` David Brownell
2005-05-31 22:12 ` Harald Welte
2005-06-06 16:05 ` Harald Welte
2005-06-06 16:24 ` Alan Stern
2005-06-06 16:50 ` Harald Welte
2005-05-30 23:07 ` Oliver Neukum
2005-05-31 8:06 ` Harald Welte
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=20050530212641.GE25536@sunbeam.de.gnumonks.org \
--to=laforge@gnumonks.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
/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®