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: <20160517110438.GB26166@ulmo.ba.sec>
Date:	Tue, 17 May 2016 13:04:38 +0200
From:	Thierry Reding <thierry.reding@...il.com>
To:	Boris Brezillon <boris.brezillon@...e-electrons.com>
Cc:	linux-pwm@...r.kernel.org,
	Mika Penttilä <mika.penttila@...tfour.com>,
	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	Daniel Mack <daniel@...que.org>,
	Haojian Zhuang <haojian.zhuang@...il.com>,
	Robert Jarzmik <robert.jarzmik@...e.fr>
Subject: Re: [PATCH] pwm: Fill pwm->args before calling
 pwm_request_from_chip()

On Tue, May 17, 2016 at 12:35:33PM +0200, Boris Brezillon wrote:
[...]
> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> index 427142d..3d2eeaa 100644
> --- a/drivers/pwm/core.c
> +++ b/drivers/pwm/core.c
> @@ -143,10 +143,6 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args)
>  	if (args->args[0] >= pc->npwm)
>  		return ERR_PTR(-EINVAL);
>  
> -	pwm = pwm_request_from_chip(pc, args->args[0], NULL);
> -	if (IS_ERR(pwm))
> -		return pwm;
> -
>  	pwm->args.period = args->args[1];
>  
>  	if (args->args[2] & PWM_POLARITY_INVERTED)
> @@ -154,6 +150,10 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args)
>  	else
>  		pwm->args.polarity = PWM_POLARITY_NORMAL;
>  
> +	pwm = pwm_request_from_chip(pc, args->args[0], NULL);
> +	if (IS_ERR(pwm))
> +		return pwm;
> +

Can't do that, because now you're dereferencing an uninitialized
pointer.

>  	return pwm;
>  }
>  EXPORT_SYMBOL_GPL(of_pwm_xlate_with_flags);
> @@ -169,12 +169,12 @@ of_pwm_simple_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
>  	if (args->args[0] >= pc->npwm)
>  		return ERR_PTR(-EINVAL);
>  
> +	pwm->args.period = args->args[1];

Same here.

> diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
> index 58b709f..c33bd42 100644
> --- a/drivers/pwm/pwm-pxa.c
> +++ b/drivers/pwm/pwm-pxa.c
> @@ -156,12 +156,12 @@ pxa_pwm_of_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
>  {
>  	struct pwm_device *pwm;
>  
> +	pwm->args.period = args->args[0];

And here.

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