sockfd_lookup_light(): switch to fdget^W^Waway from fget_light
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 4 Mar 2014 04:48:18 +0000 (23:48 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 10 Mar 2014 15:44:41 +0000 (11:44 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
net/socket.c

index 879933aaed4c07ecd9cdad1809939ff729a588a7..fd8d86e06f95f5fbb5d146e5a8afd97ef3d65426 100644 (file)
@@ -450,16 +450,17 @@ EXPORT_SYMBOL(sockfd_lookup);
 
 static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed)
 {
-       struct file *file;
+       struct fd f = fdget(fd);
        struct socket *sock;
 
        *err = -EBADF;
-       file = fget_light(fd, fput_needed);
-       if (file) {
-               sock = sock_from_file(file, err);
-               if (sock)
+       if (f.file) {
+               sock = sock_from_file(f.file, err);
+               if (likely(sock)) {
+                       *fput_needed = f.flags;
                        return sock;
-               fput_light(file, *fput_needed);
+               }
+               fdput(f);
        }
        return NULL;
 }