summaryrefslogtreecommitdiff
path: root/net/socket.c
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-19 08:16:22 +0200
commit7bedf1d86298c98240add8fcd8eafd8f2d9f2d2f (patch)
tree6849e3dea72f8c5b3d88e1b0700840644cdbbd41 /net/socket.c
parent47f873ac267b9b0093979a0d6aa9ceb2ac84ef14 (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/socket.c')
-rw-r--r--net/socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c
index 432800b39ddb..d1a0264401b7 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -485,7 +485,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);