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: <20211209212753.GC21819@hoboy.vegasvil.org>
Date:   Thu, 9 Dec 2021 13:27:53 -0800
From:   Richard Cochran <richardcochran@...il.com>
To:     Hangbin Liu <liuhangbin@...il.com>
Cc:     netdev@...r.kernel.org, Jay Vosburgh <j.vosburgh@...il.com>,
        Veaceslav Falico <vfalico@...il.com>,
        Andy Gospodarek <andy@...yhouse.net>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Heiner Kallweit <hkallweit1@...il.com>
Subject: Re: [PATCHv2 net-next 1/2] net_tstamp: add new flag
 HWTSTAMP_FLAG_BONDED_PHC_INDEX

On Thu, Dec 09, 2021 at 06:24:48PM +0800, Hangbin Liu wrote:
> diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
> index 1d309a666932..10ac5457dcbc 100644
> --- a/net/core/dev_ioctl.c
> +++ b/net/core/dev_ioctl.c
> @@ -186,18 +186,27 @@ static int net_hwtstamp_validate(struct ifreq *ifr)
>  	struct hwtstamp_config cfg;
>  	enum hwtstamp_tx_types tx_type;
>  	enum hwtstamp_rx_filters rx_filter;
> -	int tx_type_valid = 0;
> +	enum hwtstamp_flags flag;
>  	int rx_filter_valid = 0;
> +	int tx_type_valid = 0;
> +	int flag_valid = 0;
>  
>  	if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
>  		return -EFAULT;
>  
> -	if (cfg.flags) /* reserved for future extensions */
> -		return -EINVAL;
> -
> +	flag = cfg.flags;
>  	tx_type = cfg.tx_type;
>  	rx_filter = cfg.rx_filter;
>  
> +	switch (flag) {
> +	case HWTSTAMP_FLAG_BONDED_PHC_INDEX:
> +		flag_valid = 1;

This isn't correct.  You need to use a bitwise test.

Thanks,
Richard


> +		break;
> +	case __HWTSTAMP_FLAGS_CNT:
> +		/* not a real value */
> +		break;
> +	}
> +
>  	switch (tx_type) {
>  	case HWTSTAMP_TX_OFF:
>  	case HWTSTAMP_TX_ON:
> @@ -234,7 +243,7 @@ static int net_hwtstamp_validate(struct ifreq *ifr)
>  		break;
>  	}
>  
> -	if (!tx_type_valid || !rx_filter_valid)
> +	if (!flag_valid || !tx_type_valid || !rx_filter_valid)
>  		return -ERANGE;
>  
>  	return 0;
> -- 
> 2.31.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ