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, 08 Aug 2017 09:51:49 +0900
From:   Chanwoo Choi <cw00.choi@...sung.com>
To:     Santosh Mardi <gsantosh@...eaurora.org>, myungjoo.ham@...sung.com,
        kyungmin.park@...sung.com, rafael.j.wysocki@...el.com
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        gsantosh@....qualcomm.com, skannan@...cinc.com,
        rgottimu@....qualcomm.com
Subject: Re: [PATCH] devfreq: add error check for sscanf in userspace
 governor

Hi,

On 2017년 08월 07일 22:06, Santosh Mardi wrote:
> store_freq function of devfreq userspace governor
> executes further, even if error is returned from sscanf,
> this will result in setting up wrong frequency value.
> 
> Add proper error check to bail out if any error is returned.
> 
> Signed-off-by: Santosh Mardi <gsantosh@...eaurora.org>
> ---
>  drivers/devfreq/governor_userspace.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/devfreq/governor_userspace.c b/drivers/devfreq/governor_userspace.c
> index 77028c2..1d0c9cc 100644
> --- a/drivers/devfreq/governor_userspace.c
> +++ b/drivers/devfreq/governor_userspace.c
> @@ -53,12 +53,15 @@ static ssize_t store_freq(struct device *dev, struct device_attribute *attr,
>  	mutex_lock(&devfreq->lock);
>  	data = devfreq->data;
>  
> -	sscanf(buf, "%lu", &wanted);
> +	err = sscanf(buf, "%lu", &wanted);
> +	if (err != 1)
> +		goto out;
>  	data->user_frequency = wanted;
>  	data->valid = true;
>  	err = update_devfreq(devfreq);
>  	if (err == 0)
>  		err = count;
> +out:
>  	mutex_unlock(&devfreq->lock);
>  	return err;
>  }
> 

Looks good to me.
Reviewed-by: Chanwoo Choi <cw00.choi@...sung.com>

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ