Re: [PATCH] staging: speakup: kobjects.c: Use correct values when changing voice.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christopher Brannon, le Tue 10 Sep 2013 18:21:18 -0700, a écrit :
> When a new voice is selected, we set volume and pitch appropriate for
> the voice.  We need to use the numeric index corresponding to the
> voice when indexing into the volume and pitch tables, rather than
> the raw user input that was used to select the voice.
> Note that using the raw input can also lead to an invalid memory read
> in the case of invalid or malicious user input.
> 
> Signed-off-by: Christopher Brannon <chris@xxxxxxxxxxxxxxxx>

Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

> ---
>  drivers/staging/speakup/kobjects.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
> index 51bdea3..55aeeb2 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -652,7 +652,10 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr,
>  	 * If voice was just changed, we might need to reset our default
>  	 * pitch and volume.
>  	 */
> -	if (strcmp(attr->attr.name, "voice") == 0) {
> +	if (strcmp(attr->attr.name, "voice") == 0 &&
> +	    (ret == 0 || ret == -ERESTART)) {
> +		var_data = param->data;
> +		value = var_data->u.n.value;
>  		if (synth && synth->default_pitch) {
>  			param = spk_var_header_by_name("pitch");
>  			if (param)  {
> -- 
> 1.8.1.5
> 
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel





[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux