Skip to content

Commit

Permalink
sockfd_lookup_light(): switch to fdget^W^Waway from fget_light
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Mar 10, 2014
1 parent 9c225f2 commit 00e188e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 00e188e

Please sign in to comment.