From: Andrew Morton <[EMAIL PROTECTED]>
Date: Sat, 28 Jan 2006 17:22:40 -0800

> David, your tree
> git+ssh://master.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.17.git
> is oopsing all over the place.  Reverting "[NET]: Do not lose accepted
> socket when -ENFILE/-EMFILE." makes it stop:

I just checked in the following fix, thanks for the report.

diff-tree e6b303b1b4b890772f9c45f790deb1cfb49e295c (from 
dc326c4936f41911046b2dc72cbe04053e9680d6)
Author: David S. Miller <[EMAIL PROTECTED]>
Date:   Sun Jan 29 21:08:25 2006 -0800

    [NET] sys_accept: Pass correct socket to sock_attach_fd().
    
    Also, make sure "filep" is assigned to on every path through
    sock_alloc_fd().
    
    Thanks to Andrew Morton for the OOPS trace.
    
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>

diff --git a/net/socket.c b/net/socket.c
index 8d4032a..1ec0168 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -373,11 +373,11 @@ static int sock_alloc_fd(struct file **f
        if (likely(fd >= 0)) {
                struct file *file = get_empty_filp();
 
+               *filep = file;
                if (unlikely(!file)) {
                        put_unused_fd(fd);
                        return -ENFILE;
                }
-               *filep = file;
        } else
                *filep = NULL;
        return fd;
@@ -1389,12 +1389,12 @@ asmlinkage long sys_accept(int fd, struc
        __module_get(newsock->ops->owner);
 
        newfd = sock_alloc_fd(&newfile);
-       if (newfd < 0) {
+       if (unlikely(newfd < 0)) {
                err = newfd;
                goto out_release;
        }
 
-       err = sock_attach_fd(sock, newfile);
+       err = sock_attach_fd(newsock, newfile);
        if (err < 0)
                goto out_fd;
 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to