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]
Date:   Tue, 21 Mar 2017 13:11:05 +0300
From:   Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:     Jeff Kirsher <jeffrey.t.kirsher@...el.com>, davem@...emloft.net
Cc:     Jacob Keller <jacob.e.keller@...el.com>, netdev@...r.kernel.org,
        nhorman@...hat.com, sassmann@...hat.com, jogreene@...hat.com
Subject: Re: [net-next 05/13] i40e: rework exit flow of i40e_add_fdir_ethtool

Hello!

On 3/21/2017 2:47 AM, Jeff Kirsher wrote:

> From: Jacob Keller <jacob.e.keller@...el.com>
>
> Refactor the exit flow of the i40e_add_fdir_ethtool function. Move the
> input_label to the end of the function, removing the dependency on

    I don't see 'input_label' anywhere. Perhaps 'free_input' label was meant?

> having a non-zero return value. Add a comment explaining why it is ok
> not to free the fdir data structure, because the structure is now stored
> in the fdir_filter_list.
>
> Change-Id: I723342181d59cd0c9f3b31140c37961ba37bb242
> Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
> Tested-by: Andrew Bowers <andrewx.bowers@...el.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> index 7a22b473dbdd..d16a5a6b24fc 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> @@ -2828,12 +2828,19 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
>  	}
>
>  	ret = i40e_add_del_fdir(vsi, input, true);
> -free_input:
>  	if (ret)
> -		kfree(input);
> -	else
> -		i40e_update_ethtool_fdir_entry(vsi, input, fsp->location, NULL);
> +		goto free_input;
> +
> +	/* Add the input filter to the fdir_input_list, possibly replacing
> +	 * a previous filter. Do not free the input structure after adding it
> +	 * to the list as this would cause a use-after-free bug.
> +	 */
> +	i40e_update_ethtool_fdir_entry(vsi, input, fsp->location, NULL);
>
> +	return 0;
> +
> +free_input:
> +	kfree(input);
>  	return ret;
>  }

MBR, Sergei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ