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:	Wed, 26 Nov 2014 08:21:39 -0700
From:	Jens Axboe <axboe@...nel.dk>
To:	Matias Bjørling <m@...rling.me>, axboe@...com,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] null_blk: boundary check queue_mode and irqmode

On 11/26/2014 08:02 AM, Matias Bjørling wrote:
> When either queue_mode or irq_mode parameter is set outside its boundaries, the
> driver will not complete requests. This stalls driver initialization when
> partitions are probed. Fix by setting out of bound values to the parameters
> default.
>
> Signed-off-by: Matias Bjørling <m@...rling.me>
> ---
>   drivers/block/null_blk.c | 14 +++++++++++++-
>   1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
> index caa6121..efe9f76 100644
> --- a/drivers/block/null_blk.c
> +++ b/drivers/block/null_blk.c
> @@ -506,7 +506,7 @@ static int null_add_dev(void)
>   		rv = init_driver_queues(nullb);
>   		if (rv)
>   			goto out_cleanup_blk_queue;
> -	} else {
> +	} else if (queue_mode == NULL_Q_RQ) {
>   		nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node);
>   		if (!nullb->q) {
>   			rv = -ENOMEM;
> @@ -574,6 +574,18 @@ static int __init null_init(void)
>   		bs = PAGE_SIZE;
>   	}
>
> +	if (queue_mode < 0 || queue_mode > NULL_Q_MQ) {
> +		pr_warn("null_blk: invalid queue mode\n");
> +		pr_warn("null_blk: defaults queue mode to multiqueue\n");
> +		queue_mode = NULL_Q_MQ;
> +	}
> +
> +	if (irqmode < 0 || irqmode > NULL_IRQ_TIMER) {
> +		pr_warn("null_blk: invalid irq mode\n");
> +		pr_warn("null_blk: defauls irq mode to softirq\n");
> +		irqmode = NULL_IRQ_SOFTIRQ;
> +	}

Lets fix these by using module_param_cb() instead to reject invalid 
values upfront.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ