* [PATCH 2/5] net: Use helper function fdput()
@ 2020-08-06 11:52 linmiaohe
2020-08-08 21:21 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: linmiaohe @ 2020-08-06 11:52 UTC (permalink / raw)
To: davem, kuba; +Cc: netdev, linux-kernel, linmiaohe
From: Miaohe Lin <linmiaohe@huawei.com>
Use helper function fdput() to fput() the file iff FDPUT_FPUT is set.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
net/socket.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/socket.c b/net/socket.c
index 976426d03f09..6aff5aeb6728 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1805,8 +1805,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;
@@ -1869,8 +1868,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;
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/5] net: Use helper function fdput()
2020-08-06 11:52 [PATCH 2/5] net: Use helper function fdput() linmiaohe
@ 2020-08-08 21:21 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-08-08 21:21 UTC (permalink / raw)
To: linmiaohe; +Cc: kuba, netdev, linux-kernel
From: linmiaohe <linmiaohe@huawei.com>
Date: Thu, 6 Aug 2020 19:52:24 +0800
> From: Miaohe Lin <linmiaohe@huawei.com>
>
> Use helper function fdput() to fput() the file iff FDPUT_FPUT is set.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-08 21:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-06 11:52 [PATCH 2/5] net: Use helper function fdput() linmiaohe
2020-08-08 21:21 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.