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]
Message-ID: <20160610122030.GA27142@ulmo.ba.sec>
Date:	Fri, 10 Jun 2016 14:20:30 +0200
From:	Thierry Reding <thierry.reding@...il.com>
To:	Brian Norris <briannorris@...omium.org>
Cc:	linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
	Brian Norris <computersforpeace@...il.com>,
	Boris Brezillon <boris.brezillon@...e-electrons.com>,
	Doug Anderson <dianders@...omium.org>
Subject: Re: [PATCH v2] pwm: improve args checking in pwm_apply_state()

On Fri, May 27, 2016 at 09:45:49AM -0700, Brian Norris wrote:
> It seems like in the process of refactoring pwm_config() to utilize the
> newly-introduced pwm_apply_state() API, some args/bounds checking was
> dropped.
> 
> In particular, I noted that we are now allowing invalid period
> selections. e.g.:
> 
>   # echo 1 > /sys/class/pwm/pwmchip0/export
>   # cat /sys/class/pwm/pwmchip0/pwm1/period
>   100
>   # echo 101 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle
>   [... driver may or may not reject the value, or trigger some logic bug ...]
> 
> It's better to see:
> 
>   # echo 1 > /sys/class/pwm/pwmchip0/export
>   # cat /sys/class/pwm/pwmchip0/pwm1/period
>   100
>   # echo 101 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle
>   -bash: echo: write error: Invalid argument
> 
> This patch reintroduces some bounds checks in both pwm_config() (for its
> signed parameters; we don't want to convert negative values into large
> unsigned values) and in pwm_apply_state() (which fix the above described
> behavior, as well as other potential API misuses).
> 
> Fixes: 5ec803edcb70 ("pwm: Add core infrastructure to allow atomic updates")
> Signed-off-by: Brian Norris <briannorris@...omium.org>
> ---
> v2:
>  * changed subject, as this covers more scope now
>  * add Fixes tag, as this is a v4.7-rc regression
>  * add more bounds/args checks in pwm_apply_state() and pwm_config()
> 
>  drivers/pwm/core.c  | 3 ++-
>  include/linux/pwm.h | 3 +++
>  2 files changed, 5 insertions(+), 1 deletion(-)

Applied, thanks.

Thierry

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ