Skip to content

Commit 6b07ede

Browse files
MiaoheLindavem330
authored andcommitted
net: Use helper function fdput()
Use helper function fdput() to fput() the file iff FDPUT_FPUT is set. Signed-off-by: Miaohe Lin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d02cbc4 commit 6b07ede

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

net/socket.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,8 +1804,7 @@ int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,
18041804
ret = __sys_accept4_file(f.file, 0, upeer_sockaddr,
18051805
upeer_addrlen, flags,
18061806
rlimit(RLIMIT_NOFILE));
1807-
if (f.flags)
1808-
fput(f.file);
1807+
fdput(f);
18091808
}
18101809

18111810
return ret;
@@ -1868,8 +1867,7 @@ int __sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen)
18681867
ret = move_addr_to_kernel(uservaddr, addrlen, &address);
18691868
if (!ret)
18701869
ret = __sys_connect_file(f.file, &address, addrlen, 0);
1871-
if (f.flags)
1872-
fput(f.file);
1870+
fdput(f);
18731871
}
18741872

18751873
return ret;

0 commit comments

Comments
 (0)