lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5106D3BE.3030401@gmx.de>
Date:	Mon, 28 Jan 2013 20:38:38 +0100
From:	Toralf Förster <toralf.foerster@....de>
To:	"Michael S. Tsirkin" <mst@...hat.com>
CC:	Jason Wang <jasowang@...hat.com>, netdev@...r.kernel.org,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	David Miller <davem@...emloft.net>
Subject: Re: [PATCHv2] tun: fix carrier on/off status

Tested-by: Toralf Förster <toralf.foerster@....de>

On 01/28/2013 11:38 AM, Michael S. Tsirkin wrote:
> Commit c8d68e6be1c3b242f1c598595830890b65cea64a removed carrier off call
> from tun_detach since it's now called on queue disable and not only on
> tun close.  This confuses userspace which used this flag to detect a
> free tun. To fix, put this back but under if (clean).
> 
> Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
> 
> ---
> 
> Changes from v1:
> 	Don't set carrier off unless all queues are closed.
> 
> Note: didn't test in MQ mode - Jason, care checking this does the
> right thing there?
> 
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index af372d0..06b2723 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -434,10 +434,13 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
>  	}
>  
>  	if (clean) {
> -		if (tun && tun->numqueues == 0 && tun->numdisabled == 0 &&
> -		    !(tun->flags & TUN_PERSIST))
> -			if (tun->dev->reg_state == NETREG_REGISTERED)
> +		if (tun && tun->numqueues == 0 && tun->numdisabled == 0) {
> +			netif_carrier_off(tun->dev);
> +
> +			if (!(tun->flags & TUN_PERSIST) &&
> +			    tun->dev->reg_state == NETREG_REGISTERED)
>  				unregister_netdevice(tun->dev);
> +		}
>  
>  		BUG_ON(!test_bit(SOCK_EXTERNALLY_ALLOCATED,
>  				 &tfile->socket.flags));
> @@ -1644,10 +1647,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
>  		    device_create_file(&tun->dev->dev, &dev_attr_owner) ||
>  		    device_create_file(&tun->dev->dev, &dev_attr_group))
>  			pr_err("Failed to create tun sysfs files\n");
> -
> -		netif_carrier_on(tun->dev);
>  	}
>  
> +	netif_carrier_on(tun->dev);
> +
>  	tun_debug(KERN_INFO, tun, "tun_set_iff\n");
>  
>  	if (ifr->ifr_flags & IFF_NO_PI)
> 


-- 
MfG/Sincerely
Toralf Förster
pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ