summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2020-08-06 19:53:16 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-21 10:53:03 +0200
commitf1f8c3303a663e2f685c4d6842e8b2832c67b3cf (patch)
tree49c2891d6de9d0614e26f164cfb25d6c5410b5a1 /net
parentde7c8ab8cb412d21ffdac94a99ef2f29f7802fd1 (diff)
net: Set fput_needed iff FDPUT_FPUT is set
[ Upstream commit ce787a5a074a86f76f5d3fd804fa78e01bfb9e89 ] We should fput() file iff FDPUT_FPUT is set. So we should set fput_needed accordingly. Fixes: 00e188ef6a7e ("sockfd_lookup_light(): switch to fdget^W^Waway from fget_light") Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c
index 88086d18c208..1392461d391a 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -456,7 +456,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed)
if (f.file) {
sock = sock_from_file(f.file, err);
if (likely(sock)) {
- *fput_needed = f.flags;
+ *fput_needed = f.flags & FDPUT_FPUT;
return sock;
}
fdput(f);