File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1747,9 +1747,14 @@ int io_bind(struct io_kiocb *req, unsigned int issue_flags)
1747
1747
{
1748
1748
struct io_bind * bind = io_kiocb_to_cmd (req , struct io_bind );
1749
1749
struct io_async_msghdr * io = req -> async_data ;
1750
+ struct socket * sock ;
1750
1751
int ret ;
1751
1752
1752
- ret = __sys_bind_socket (sock_from_file (req -> file ), & io -> addr , bind -> addr_len );
1753
+ sock = sock_from_file (req -> file );
1754
+ if (unlikely (!sock ))
1755
+ return - ENOTSOCK ;
1756
+
1757
+ ret = __sys_bind_socket (sock , & io -> addr , bind -> addr_len );
1753
1758
if (ret < 0 )
1754
1759
req_set_fail (req );
1755
1760
io_req_set_res (req , ret , 0 );
@@ -1770,9 +1775,14 @@ int io_listen_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
1770
1775
int io_listen (struct io_kiocb * req , unsigned int issue_flags )
1771
1776
{
1772
1777
struct io_listen * listen = io_kiocb_to_cmd (req , struct io_listen );
1778
+ struct socket * sock ;
1773
1779
int ret ;
1774
1780
1775
- ret = __sys_listen_socket (sock_from_file (req -> file ), listen -> backlog );
1781
+ sock = sock_from_file (req -> file );
1782
+ if (unlikely (!sock ))
1783
+ return - ENOTSOCK ;
1784
+
1785
+ ret = __sys_listen_socket (sock , listen -> backlog );
1776
1786
if (ret < 0 )
1777
1787
req_set_fail (req );
1778
1788
io_req_set_res (req , ret , 0 );
You can’t perform that action at this time.
0 commit comments