lkml.org 
[lkml]   [1999]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH] FD array expansion problem
    On Sat, 30 Oct 1999, Savochkin Andrey Vladimirovich wrote:

    >Hi,
    >
    >I've spotted a bug in the dynamic fd array expansion code.
    >Here is the patch which
    > - fixes wrong parameters of expand_fdset() and expand_fd_array() calls
    > in expand_files() and get_unused_fd(); and
    > - moves expand_files() function from sched.h to fs/fcntl.c.

    Good spotting! ;))

    I did the backport to 2.2.13:

    --- 2.2.13-fdset/fs/open.c.~1~ Sat Oct 23 15:31:10 1999
    +++ 2.2.13-fdset/fs/open.c Sat Oct 30 18:47:04 1999
    @@ -712,7 +712,7 @@

    /* Do we need to expand the fdset array? */
    if (fd >= current->files->max_fdset) {
    - error = expand_fdset(files, 0);
    + error = expand_fdset(files, fd + 1);
    if (!error)
    goto repeat;
    goto out;
    @@ -722,7 +722,7 @@
    * Check whether we need to expand the fd array.
    */
    if (fd >= files->max_fds) {
    - error = expand_fd_array(files, 0);
    + error = expand_fd_array(files, fd + 1);
    if (!error)
    goto repeat;
    goto out;
    --- 2.2.13-fdset/include/linux/sched.h.~1~ Fri Oct 29 22:41:14 1999
    +++ 2.2.13-fdset/include/linux/sched.h Sat Oct 30 18:46:32 1999
    @@ -657,12 +657,12 @@

    if (nr >= files->max_fdset) {
    expand = 1;
    - if ((err = expand_fdset(files, nr)))
    + if ((err = expand_fdset(files, nr + 1)))
    goto out;
    }
    if (nr >= files->max_fds) {
    expand = 1;
    - if ((err = expand_fd_array(files, nr)))
    + if ((err = expand_fd_array(files, nr + 1)))
    goto out;
    }
    err = expand;
    Andrea


    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:54    [W:0.037 / U:0.004 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site