public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Helge Hafting <helgehaf@aitel.hist.no>
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.4.39 "Sleeping function called from illegal context at  slab.c:1374"
Date: Tue, 01 Oct 2002 11:54:26 -0700	[thread overview]
Message-ID: <3D99EF62.3A3E6932@digeo.com> (raw)
In-Reply-To: 3D99885B.533C320D@aitel.hist.no

Helge Hafting wrote:
> 
> ..
>  [<c01146c4>]__might_sleep+0x54/0x60
>  [<c012dca0>]kmalloc+0x4c/0x130
>  [<c010b6b2>]sys_ioperm+0x82/0x11c
>  [<c0106fbb>]syscall_call+0x7/0xb
> 


You up to trying this fix?

--- 2.5.40/arch/i386/kernel/ioport.c~ioperm-fix	Tue Oct  1 02:17:51 2002
+++ 2.5.40-akpm/arch/i386/kernel/ioport.c	Tue Oct  1 02:17:51 2002
@@ -56,6 +56,7 @@ asmlinkage int sys_ioperm(unsigned long 
 {
 	struct thread_struct * t = &current->thread;
 	struct tss_struct * tss;
+	unsigned long *bitmap = NULL;
 	int ret = 0;
 
 	if ((from + num <= from) || (from + num > IO_BITMAP_SIZE*32))
@@ -63,15 +64,12 @@ asmlinkage int sys_ioperm(unsigned long 
 	if (turn_on && !capable(CAP_SYS_RAWIO))
 		return -EPERM;
 
-	tss = init_tss + get_cpu();
-
 	/*
 	 * If it's the first ioperm() call in this thread's lifetime, set the
 	 * IO bitmap up. ioperm() is much less timing critical than clone(),
 	 * this is why we delay this operation until now:
 	 */
 	if (!t->ts_io_bitmap) {
-		unsigned long *bitmap;
 		bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
 		if (!bitmap) {
 			ret = -ENOMEM;
@@ -83,20 +81,19 @@ asmlinkage int sys_ioperm(unsigned long 
 		 */
 		memset(bitmap, 0xff, IO_BITMAP_BYTES);
 		t->ts_io_bitmap = bitmap;
-		/*
-		 * this activates it in the TSS
-		 */
-		tss->bitmap = IO_BITMAP_OFFSET;
 	}
 
+	tss = init_tss + get_cpu();
+	if (bitmap)
+		tss->bitmap = IO_BITMAP_OFFSET;	/* Activate it in the TSS */
+
 	/*
 	 * do it in the per-thread copy and in the TSS ...
 	 */
 	set_bitmap(t->ts_io_bitmap, from, num, !turn_on);
 	set_bitmap(tss->io_bitmap, from, num, !turn_on);
-
-out:
 	put_cpu();
+out:
 	return ret;
 }
 

.

  parent reply	other threads:[~2002-10-01 18:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-01 11:34 2.4.39 "Sleeping function called from illegal context at slab.c:1374" Helge Hafting
2002-10-01 11:39 ` Jens Axboe
2002-10-01 18:54 ` Andrew Morton [this message]
2002-10-01 21:59   ` Andreas Boman
2002-10-01 22:23     ` Andrew Morton
2002-10-01 23:24       ` Joaquim Fellmann
2002-10-02 16:24       ` Mike Anderson
2002-10-02 18:44         ` Andreas Boman
2002-10-02 19:31           ` Mike Anderson
2002-10-02 21:21           ` Mike Anderson
2002-10-02 23:53             ` Andreas Boman
2002-10-03 17:17               ` Mike Anderson

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=3D99EF62.3A3E6932@digeo.com \
    --to=akpm@digeo.com \
    --cc=helgehaf@aitel.hist.no \
    --cc=linux-kernel@vger.kernel.org \
    /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