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: <528AF66F.2060204@st.com>
Date:	Tue, 19 Nov 2013 06:26:07 +0100
From:	Giuseppe CAVALLARO <peppe.cavallaro@...com>
To:	Ben Hutchings <bhutchings@...arflare.com>,
	Rayagond K <rayagond@...avyalabs.com>
Cc:	David Miller <davem@...emloft.net>, <netdev@...r.kernel.org>,
	Richard Cochran <richardcochran@...il.com>
Subject: Re: [PATCH net 4/6] stmmac: Validate hwtstamp_config completely before
 applying it

On 11/14/2013 1:44 AM, Ben Hutchings wrote:
> stmmac_hwtstamp_ioctl() should validate all fields of hwtstamp_config
> before making any changes.  Currently it sets the TX configuration
> before validating the rx_filter field.
>
> Compile-tested only.

Thx Ben for this patch.

Rayagond, can you do any run-time tests?

peppe

>
> Signed-off-by: Ben Hutchings <bhutchings@...arflare.com>
> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 +++---------
>   1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 8d4ccd35a016..8a7a23a84ac5 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -435,16 +435,9 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
>   	if (config.flags)
>   		return -EINVAL;
>
> -	switch (config.tx_type) {
> -	case HWTSTAMP_TX_OFF:
> -		priv->hwts_tx_en = 0;
> -		break;
> -	case HWTSTAMP_TX_ON:
> -		priv->hwts_tx_en = 1;
> -		break;
> -	default:
> +	if (config.tx_type != HWTSTAMP_TX_OFF &&
> +	    config.tx_type != HWTSTAMP_TX_ON)
>   		return -ERANGE;
> -	}
>
>   	if (priv->adv_ts) {
>   		switch (config.rx_filter) {
> @@ -576,6 +569,7 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
>   		}
>   	}
>   	priv->hwts_rx_en = ((config.rx_filter == HWTSTAMP_FILTER_NONE) ? 0 : 1);
> +	priv->hwts_tx_en = config.tx_type == HWTSTAMP_TX_ON;
>
>   	if (!priv->hwts_tx_en && !priv->hwts_rx_en)
>   		priv->hw->ptp->config_hw_tstamping(priv->ioaddr, 0);
>
>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ