mbox series

[v4,0/2] net: tap: check file descriptor can be used

Message ID 20200707184515.371476-1-lvivier@redhat.com
Headers show
Series net: tap: check file descriptor can be used | expand

Message

Laurent Vivier July 7, 2020, 6:45 p.m. UTC
v4: use qemu_try_set_nonblock() with vhostfd in net_init_tap_one(),
    and with fd in net_init_socket()

v3: move qemu_fd_is_valid() checking into a new function
    qemu_try_set_nonblock(), and use qemu_try_set_nonblock() in
    qemu_set_nonblock().

v2: Add patch from Daniel to check the fd can be used

    I have updated Daniel's patch not to check for EINVAL on TUNGETIFF
    as I think we can avoid this special case because TUNGETIFF
    is available since kernel v2.6.27 (October 2008)
    Moreover I think the code was wrong as it was checking with -EINVAL and
    not EINVAL.

Daniel P. Berrangé (1):
  net: detect errors from probing vnet hdr flag for TAP devices

Laurent Vivier (1):
  net: check if the file descriptor is valid before using it

 include/qemu/sockets.h |  1 +
 net/socket.c           |  9 +++++--
 net/tap-bsd.c          |  2 +-
 net/tap-linux.c        |  8 +++---
 net/tap-solaris.c      |  2 +-
 net/tap-stub.c         |  2 +-
 net/tap.c              | 50 +++++++++++++++++++++++++++++-------
 net/tap_int.h          |  2 +-
 util/oslib-posix.c     | 26 +++++++++++++------
 util/oslib-win32.c     | 57 ++++++++++++++++++++++++------------------
 10 files changed, 108 insertions(+), 51 deletions(-)

Comments

Jason Wang July 9, 2020, 5:46 a.m. UTC | #1
On 2020/7/8 上午2:45, Laurent Vivier wrote:
> v4: use qemu_try_set_nonblock() with vhostfd in net_init_tap_one(),
>      and with fd in net_init_socket()
>
> v3: move qemu_fd_is_valid() checking into a new function
>      qemu_try_set_nonblock(), and use qemu_try_set_nonblock() in
>      qemu_set_nonblock().
>
> v2: Add patch from Daniel to check the fd can be used
>
>      I have updated Daniel's patch not to check for EINVAL on TUNGETIFF
>      as I think we can avoid this special case because TUNGETIFF
>      is available since kernel v2.6.27 (October 2008)
>      Moreover I think the code was wrong as it was checking with -EINVAL and
>      not EINVAL.
>
> Daniel P. Berrangé (1):
>    net: detect errors from probing vnet hdr flag for TAP devices
>
> Laurent Vivier (1):
>    net: check if the file descriptor is valid before using it
>
>   include/qemu/sockets.h |  1 +
>   net/socket.c           |  9 +++++--
>   net/tap-bsd.c          |  2 +-
>   net/tap-linux.c        |  8 +++---
>   net/tap-solaris.c      |  2 +-
>   net/tap-stub.c         |  2 +-
>   net/tap.c              | 50 +++++++++++++++++++++++++++++-------
>   net/tap_int.h          |  2 +-
>   util/oslib-posix.c     | 26 +++++++++++++------
>   util/oslib-win32.c     | 57 ++++++++++++++++++++++++------------------
>   10 files changed, 108 insertions(+), 51 deletions(-)


Applied.

Thanks


>
Laurent Vivier July 15, 2020, 9:16 a.m. UTC | #2
On 09/07/2020 07:46, Jason Wang wrote:
> 
> On 2020/7/8 上午2:45, Laurent Vivier wrote:
>> v4: use qemu_try_set_nonblock() with vhostfd in net_init_tap_one(),
>>      and with fd in net_init_socket()
>>
>> v3: move qemu_fd_is_valid() checking into a new function
>>      qemu_try_set_nonblock(), and use qemu_try_set_nonblock() in
>>      qemu_set_nonblock().
>>
>> v2: Add patch from Daniel to check the fd can be used
>>
>>      I have updated Daniel's patch not to check for EINVAL on TUNGETIFF
>>      as I think we can avoid this special case because TUNGETIFF
>>      is available since kernel v2.6.27 (October 2008)
>>      Moreover I think the code was wrong as it was checking with
>> -EINVAL and
>>      not EINVAL.
>>
>> Daniel P. Berrangé (1):
>>    net: detect errors from probing vnet hdr flag for TAP devices
>>
>> Laurent Vivier (1):
>>    net: check if the file descriptor is valid before using it
>>
>>   include/qemu/sockets.h |  1 +
>>   net/socket.c           |  9 +++++--
>>   net/tap-bsd.c          |  2 +-
>>   net/tap-linux.c        |  8 +++---
>>   net/tap-solaris.c      |  2 +-
>>   net/tap-stub.c         |  2 +-
>>   net/tap.c              | 50 +++++++++++++++++++++++++++++-------
>>   net/tap_int.h          |  2 +-
>>   util/oslib-posix.c     | 26 +++++++++++++------
>>   util/oslib-win32.c     | 57 ++++++++++++++++++++++++------------------
>>   10 files changed, 108 insertions(+), 51 deletions(-)
> 
> 
> Applied.

It would have been great to have these fixes in 5.1

Thanks,
Laurent
Jason Wang July 15, 2020, 2:03 p.m. UTC | #3
On 2020/7/15 下午5:16, Laurent Vivier wrote:
> On 09/07/2020 07:46, Jason Wang wrote:
>> On 2020/7/8 上午2:45, Laurent Vivier wrote:
>>> v4: use qemu_try_set_nonblock() with vhostfd in net_init_tap_one(),
>>>       and with fd in net_init_socket()
>>>
>>> v3: move qemu_fd_is_valid() checking into a new function
>>>       qemu_try_set_nonblock(), and use qemu_try_set_nonblock() in
>>>       qemu_set_nonblock().
>>>
>>> v2: Add patch from Daniel to check the fd can be used
>>>
>>>       I have updated Daniel's patch not to check for EINVAL on TUNGETIFF
>>>       as I think we can avoid this special case because TUNGETIFF
>>>       is available since kernel v2.6.27 (October 2008)
>>>       Moreover I think the code was wrong as it was checking with
>>> -EINVAL and
>>>       not EINVAL.
>>>
>>> Daniel P. Berrangé (1):
>>>     net: detect errors from probing vnet hdr flag for TAP devices
>>>
>>> Laurent Vivier (1):
>>>     net: check if the file descriptor is valid before using it
>>>
>>>    include/qemu/sockets.h |  1 +
>>>    net/socket.c           |  9 +++++--
>>>    net/tap-bsd.c          |  2 +-
>>>    net/tap-linux.c        |  8 +++---
>>>    net/tap-solaris.c      |  2 +-
>>>    net/tap-stub.c         |  2 +-
>>>    net/tap.c              | 50 +++++++++++++++++++++++++++++-------
>>>    net/tap_int.h          |  2 +-
>>>    util/oslib-posix.c     | 26 +++++++++++++------
>>>    util/oslib-win32.c     | 57 ++++++++++++++++++++++++------------------
>>>    10 files changed, 108 insertions(+), 51 deletions(-)
>>
>> Applied.
> It would have been great to have these fixes in 5.1
>
> Thanks,
> Laurent


Yes, pull has been sent.

Sorry for the late.

Thanks