[PATCH] um: vector: always reset vp->opened

Anton Ivanov anton.ivanov at kot-begemot.co.uk
Thu Jul 4 00:00:45 PDT 2024



On 03/07/2024 17:46, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg at intel.com>
> 
> If open fails, we have already set vp->opened, but it's
> not reset so that any further attempts will just return
> -ENXIO. Reset vp->opened even if close has nothing to do.
> 
> This helps e.g. with slirp4netns handling only a single
> connection, you can then restart it and open the device
> again.
> 
> Signed-off-by: Johannes Berg <johannes.berg at intel.com>
> ---
>   arch/um/drivers/vector_kern.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
> index 0861e32d2fbd..2d473282ab51 100644
> --- a/arch/um/drivers/vector_kern.c
> +++ b/arch/um/drivers/vector_kern.c
> @@ -1119,6 +1119,8 @@ static int vector_net_close(struct net_device *dev)
>   	netif_stop_queue(dev);
>   	del_timer(&vp->tl);
>   
> +	vp->opened = false;
> +
>   	if (vp->fds == NULL)
>   		return 0;
>   
> @@ -1157,7 +1159,6 @@ static int vector_net_close(struct net_device *dev)
>   		destroy_queue(vp->tx_queue);
>   	kfree(vp->fds);
>   	vp->fds = NULL;
> -	vp->opened = false;
>   	vp->in_error = false;
>   	return 0;
>   }
Acked-By: Anton Ivanov <anton.ivanov at cambridgegreys.com>
-- 
Anton R. Ivanov
https://www.kot-begemot.co.uk/



More information about the linux-um mailing list