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 11:02:04 +0200
commit645086be4e07133dcf4a1bcd8e0afd3824ab2423 (patch)
tree8b462ccdc653d93e4bd80990964313c75d2895f4 /net
parent1b0eab4e8622183ff26230a589b33f533dfbf7b4 (diff)
downloadlinux-645086be4e07133dcf4a1bcd8e0afd3824ab2423.tar.gz
linux-645086be4e07133dcf4a1bcd8e0afd3824ab2423.tar.bz2
linux-645086be4e07133dcf4a1bcd8e0afd3824ab2423.zip
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 88abc72df2a6..ab64ae80ca2c 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -498,7 +498,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);