Skip to content

Commit ce787a5

Browse files
MiaoheLindavem330
authored andcommitted
net: Set fput_needed iff FDPUT_FPUT is set
We should fput() file iff FDPUT_FPUT is set. So we should set fput_needed accordingly. Fixes: 00e188e ("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>
1 parent 6b07ede commit ce787a5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/socket.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed)
500500
if (f.file) {
501501
sock = sock_from_file(f.file, err);
502502
if (likely(sock)) {
503-
*fput_needed = f.flags;
503+
*fput_needed = f.flags & FDPUT_FPUT;
504504
return sock;
505505
}
506506
fdput(f);

0 commit comments

Comments
 (0)