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] [day] [month] [year] [list]
Date:   Mon, 19 Oct 2020 11:23:48 -0600
From:   Jens Axboe <axboe@...nel.dk>
To:     Hui Su <sh_def@....com>, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] block/elevator: reduce the critical section

On 10/19/20 10:42 AM, Hui Su wrote:
> @@ -633,23 +633,21 @@ static struct elevator_type *elevator_get_default(struct request_queue *q)
>   */
>  static struct elevator_type *elevator_get_by_features(struct request_queue *q)
>  {
> -	struct elevator_type *e, *found = NULL;
> +	struct elevator_type *e = NULL;
>  
>  	spin_lock(&elv_list_lock);
> -
>  	list_for_each_entry(e, &elv_list, list) {
>  		if (elv_support_features(e->elevator_features,
>  					 q->required_elevator_features)) {
> -			found = e;
>  			break;
>  		}
>  	}
> +	spin_unlock(&elv_list_lock);
>  
> -	if (found && !try_module_get(found->elevator_owner))
> -		found = NULL;
> +	if (e && !try_module_get(e->elevator_owner))
> +		e = NULL;
>  
> -	spin_unlock(&elv_list_lock);
> -	return found;
> +	return e;
>  }

This looks wrong as well. If we don't match the elevator, then we just
return the last one. Or maybe even a totally invalid entry, depending on
how the list iteration works.


-- 
Jens Axboe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ