]> err.no Git - linux-2.6/commitdiff
[NET]: sockfd_lookup_light() returns random error for -EBADFD
authorHua Zhong <hzhong@gmail.com>
Wed, 19 Apr 2006 22:25:02 +0000 (15:25 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Apr 2006 22:25:02 +0000 (15:25 -0700)
This applies to 2.6.17-rc2.

There is a missing initialization of err in sockfd_lookup_light() that
could return random error for an invalid file handle.

Signed-off-by: Hua Zhong <hzhong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/socket.c

index 23898f45f7137d2da995ebe8c89784e1deefaf13..0ce12dfc7a71651cd1d3c49f8d7881da14a02020 100644 (file)
@@ -490,6 +490,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed)
        struct file *file;
        struct socket *sock;
 
+       *err = -EBADF;
        file = fget_light(fd, fput_needed);
        if (file) {
                sock = sock_from_file(file, err);