mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 21:24:08 +08:00
sockfd_lookup_light(): switch to fdget^W^Waway from fget_light
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
9c225f2655
commit
00e188ef6a
13
net/socket.c
13
net/socket.c
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user