]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: Use helper function fdput()
authorMiaohe Lin <linmiaohe@huawei.com>
Thu, 6 Aug 2020 11:52:24 +0000 (19:52 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 8 Aug 2020 21:19:16 +0000 (14:19 -0700)
Use helper function fdput() to fput() the file iff FDPUT_FPUT is set.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/socket.c

index aff52e81653ce32550d60300067882fba3cb635f..3c3d6abe4c1eef5f32073e8034aff54d360a223e 100644 (file)
@@ -1804,8 +1804,7 @@ int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,
                ret = __sys_accept4_file(f.file, 0, upeer_sockaddr,
                                                upeer_addrlen, flags,
                                                rlimit(RLIMIT_NOFILE));
-               if (f.flags)
-                       fput(f.file);
+               fdput(f);
        }
 
        return ret;
@@ -1868,8 +1867,7 @@ int __sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen)
                ret = move_addr_to_kernel(uservaddr, addrlen, &address);
                if (!ret)
                        ret = __sys_connect_file(f.file, &address, addrlen, 0);
-               if (f.flags)
-                       fput(f.file);
+               fdput(f);
        }
 
        return ret;