提交 ce787a5a 编写于 作者: M Miaohe Lin 提交者: David S. Miller

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: 00e188ef ("sockfd_lookup_light(): switch to fdget^W^Waway from fget_light")
Signed-off-by: NMiaohe Lin <linmiaohe@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6b07edeb
...@@ -500,7 +500,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) ...@@ -500,7 +500,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed)
if (f.file) { if (f.file) {
sock = sock_from_file(f.file, err); sock = sock_from_file(f.file, err);
if (likely(sock)) { if (likely(sock)) {
*fput_needed = f.flags; *fput_needed = f.flags & FDPUT_FPUT;
return sock; return sock;
} }
fdput(f); fdput(f);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册