--- a/net/socket.c +++ b/net/socket.c @@ -496,7 +496,7 @@ static struct socket *sockfd_lookup_ligh 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);