public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] 3 one-liner bugfixes
Date: Sat, 05 May 2001 00:08:50 +0200	[thread overview]
Message-ID: <3AF32872.9137D070@colorfullife.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 408 bytes --]

Hi Linus,

I found a 3 small bugs:

* mm/slab.c: the offslab_limit calculation used 2 instead of
sizeof(kmem_bufctl_t) [==4]. Cosmetic bug, since offslab_limit is never
reached.

* expand_stack is not down_read() safe, but used in the page-in path.
Fix is trivial.

* missing/wrong lock_kernel calls in fs/fcntl.c: getlk/setlk run without
the big kernel lock. The ..64 function acquire the lock.

--
	Manfred

[-- Attachment #2: patch-slabbug-2 --]
[-- Type: text/plain, Size: 455 bytes --]

--- 2.4/mm/slab.c	Sat Mar  3 17:58:05 2001
+++ build-2.4/mm/slab.c	Sat Mar  3 19:57:16 2001
@@ -448,7 +448,7 @@
 		/* Inc off-slab bufctl limit until the ceiling is hit. */
 		if (!(OFF_SLAB(sizes->cs_cachep))) {
 			offslab_limit = sizes->cs_size-sizeof(slab_t);
-			offslab_limit /= 2;
+			offslab_limit /= sizeof(kmem_bufctl_t);
 		}
 		sprintf(name, "size-%Zd(DMA)",sizes->cs_size);
 		sizes->cs_dmacachep = kmem_cache_create(name, sizes->cs_size, 0,

[-- Attachment #3: patch-expand-stack --]
[-- Type: text/plain, Size: 722 bytes --]

--- 2.4/include/linux/mm.h	Mon Apr 30 23:14:10 2001
+++ build-2.4/include/linux/mm.h	Fri May  4 23:14:35 2001
@@ -502,12 +502,14 @@
 {
 	unsigned long grow;
 
+	spin_lock(&vma->vm_mm->page_table_lock);
 	address &= PAGE_MASK;
 	grow = (vma->vm_start - address) >> PAGE_SHIFT;
 	if (vma->vm_end - address > current->rlim[RLIMIT_STACK].rlim_cur ||
-	    ((vma->vm_mm->total_vm + grow) << PAGE_SHIFT) > current->rlim[RLIMIT_AS].rlim_cur)
+	    ((vma->vm_mm->total_vm + grow) << PAGE_SHIFT) > current->rlim[RLIMIT_AS].rlim_cur) {
+		spin_unlock(&vma->vm_mm->page_table_lock);
 		return -ENOMEM;
-	spin_lock(&vma->vm_mm->page_table_lock);
+	}
 	vma->vm_start = address;
 	vma->vm_pgoff -= grow;
 	vma->vm_mm->total_vm += grow;

[-- Attachment #4: patch-fcntl --]
[-- Type: text/plain, Size: 1014 bytes --]

--- 2.4/fs/fcntl.c	Thu Nov 16 07:50:25 2000
+++ build-2.4/fs/fcntl.c	Fri May  4 23:12:24 2001
@@ -254,11 +254,15 @@
 			unlock_kernel();
 			break;
 		case F_GETLK:
+			lock_kernel();
 			err = fcntl_getlk(fd, (struct flock *) arg);
+			unlock_kernel();
 			break;
 		case F_SETLK:
 		case F_SETLKW:
+			lock_kernel();
 			err = fcntl_setlk(fd, cmd, (struct flock *) arg);
+			unlock_kernel();
 			break;
 		case F_GETOWN:
 			/*
@@ -338,22 +342,26 @@
 	if (!filp)
 		goto out;
 
-	lock_kernel();
 	switch (cmd) {
 		case F_GETLK64:
+			lock_kernel();
 			err = fcntl_getlk64(fd, (struct flock64 *) arg);
+			unlock_kernel();
 			break;
 		case F_SETLK64:
+			lock_kernel();
 			err = fcntl_setlk64(fd, cmd, (struct flock64 *) arg);
+			unlock_kernel();
 			break;
 		case F_SETLKW64:
+			lock_kernel();
 			err = fcntl_setlk64(fd, cmd, (struct flock64 *) arg);
+			unlock_kernel();
 			break;
 		default:
 			err = do_fcntl(fd, cmd, arg, filp);
 			break;
 	}
-	unlock_kernel();
 	fput(filp);
 out:
 	return err;

             reply	other threads:[~2001-05-04 22:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-04 22:08 Manfred Spraul [this message]
2001-05-04 22:20 ` [PATCH] 3 one-liner bugfixes Linus Torvalds
2001-05-04 23:25   ` Manfred Spraul
2001-05-04 23:58     ` Manfred Spraul

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=3AF32872.9137D070@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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