summaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2020-08-06 13:52:24 +0200
committerDavid S. Miller <davem@davemloft.net>2020-08-08 23:19:16 +0200
commit6b07edebe6d31529346e553a7b309bc5251da712 (patch)
tree9a98ef07492b56330155050a1ee854820244e333 /net/socket.c
parentnet: phy: fix memory leak in device-create error path (diff)
downloadlinux-6b07edebe6d31529346e553a7b309bc5251da712.tar.xz
linux-6b07edebe6d31529346e553a7b309bc5251da712.zip
net: Use helper function fdput()
Use helper function fdput() to fput() the file iff FDPUT_FPUT is set. Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/socket.c b/net/socket.c
index aff52e81653c..3c3d6abe4c1e 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1804,8 +1804,7 @@ int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,
ret = __sys_accept4_file(f.file, 0, upeer_sockaddr,
upeer_addrlen, flags,
rlimit(RLIMIT_NOFILE));
- if (f.flags)
- fput(f.file);
+ fdput(f);
}
return ret;
@@ -1868,8 +1867,7 @@ int __sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen)
ret = move_addr_to_kernel(uservaddr, addrlen, &address);
if (!ret)
ret = __sys_connect_file(f.file, &address, addrlen, 0);
- if (f.flags)
- fput(f.file);
+ fdput(f);
}
return ret;