1
0
Fork 0

net: Set fput_needed iff FDPUT_FPUT is set

[ Upstream commit ce787a5a07 ]

We should fput() file iff FDPUT_FPUT is set. So we should set fput_needed
accordingly.

Fixes: 00e188ef6a ("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>
5.4-rM2-2.2.x-imx-squashed
Miaohe Lin 2020-08-06 19:53:16 +08:00 committed by Greg Kroah-Hartman
parent 47f873ac26
commit 7bedf1d862
1 changed files with 1 additions and 1 deletions

View File

@ -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);