[lustre-devel] [PATCH 1/4] lustre: lnet_startup_lndnet: avoid use-after-free

James Simmons jsimmons at infradead.org
Wed Dec 26 18:13:06 PST 2018


> If lnet_startup_lndni() fails it will free 'ni'.
> So we mustn't de-reference it in the LASSERT() in that case.

Reviewed-by: James Simmons <jsimmons at infradead.org>
 
> Signed-off-by: NeilBrown <neilb at suse.com>
> ---
>  drivers/staging/lustre/lnet/lnet/api-ni.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c
> index fadd5d7f187a..6d528242acd9 100644
> --- a/drivers/staging/lustre/lnet/lnet/api-ni.c
> +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
> @@ -1848,12 +1848,12 @@ lnet_startup_lndnet(struct lnet_net *net, struct lnet_lnd_tunables *tun)
>  
>  		rc = lnet_startup_lndni(ni, tun);
>  
> -		LASSERT(ni->ni_net->net_tunables.lct_peer_timeout <= 0 ||
> -			ni->ni_net->net_lnd->lnd_query);
> -
>  		if (rc < 0)
>  			goto failed1;
>  
> +		LASSERT(ni->ni_net->net_tunables.lct_peer_timeout <= 0 ||
> +			ni->ni_net->net_lnd->lnd_query);
> +
>  		lnet_ni_addref(ni);
>  		list_add_tail(&ni->ni_netlist, &local_ni_list);
>  
> 
> 
> 


More information about the lustre-devel mailing list