lkml.org 
[lkml]   [2001]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patches in this message
    /
    Date
    From
    Subject[PATCH] 3 one-liner bugfixes
    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--- 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,--- 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;--- 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;
    \
     
     \ /
      Last update: 2005-03-22 12:52    [W:0.050 / U:1.220 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site