[dpdk-stable] [PATCH v1] net/virtio-user: fix return value check

Maxime Coquelin maxime.coquelin at redhat.com
Wed Jul 29 16:22:31 CEST 2020



On 7/29/20 3:12 PM, Chenbo Xia wrote:
> Setting the flags of tapfd may fail and the return value
> should be checked.
> 
> Coverity issue: 140739
> Fixes: e3b434818bbb ("net/virtio-user: support kernel vhost")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Chenbo Xia <chenbo.xia at intel.com>
> ---
>  drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
> index 2fa4f0d66..acddefa33 100644
> --- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
> +++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
> @@ -128,7 +128,10 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq,
>  		goto error;
>  	}
>  
> -	fcntl(tapfd, F_SETFL, O_NONBLOCK);
> +	if (fcntl(tapfd, F_SETFL, O_NONBLOCK) < 0) {
> +		PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", strerror(errno));
> +		goto error;
> +	}
>  
>  	if (ioctl(tapfd, TUNSETVNETHDRSZ, &hdr_size) < 0) {
>  		PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", strerror(errno));
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>

Thanks,
Maxime



More information about the stable mailing list