public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 3 one-liner bugfixes
@ 2001-05-04 22:08 Manfred Spraul
  2001-05-04 22:20 ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Manfred Spraul @ 2001-05-04 22:08 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

[-- 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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-05-04 23:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-04 22:08 [PATCH] 3 one-liner bugfixes Manfred Spraul
2001-05-04 22:20 ` Linus Torvalds
2001-05-04 23:25   ` Manfred Spraul
2001-05-04 23:58     ` Manfred Spraul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox