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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180531170024.GA56777@decatoncale.mtv.corp.google.com>
Date:   Thu, 31 May 2018 10:00:24 -0700
From:   Benson Leung <bleung@...gle.com>
To:     Stephen Boyd <swboyd@...omium.org>
Cc:     Lee Jones <lee.jones@...aro.org>, linux-kernel@...r.kernel.org,
        Benson Leung <bleung@...omium.org>,
        Enric Balletbo i Serra <enric.balletbo@...labora.com>,
        Gwendal Grignou <gwendal@...omium.org>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        vpalatin@...omium.org
Subject: Re: [PATCH] mfd: cros_ec_dev: Don't advertise junk features on
 failure

Hi Stephen,

On Wed, May 30, 2018 at 11:23:43PM -0700, Stephen Boyd wrote:
> If the feature query fails during this driver's probe, we memset the
> features bits to 0, but then we continue to overwrite that with whatever
> junk we read back when the feature probing failed. In the case of a SPI
> device, it may be complete junk, causing the caller of this function to
> think certain features are present when they aren't. Don't copy over the
> bad message on failure so we can fail more gracefully.
> 
> Fixes: e4244ebddae2 ("platform/chrome: Introduce a new function to check EC features.")
> Cc: Benson Leung <bleung@...omium.org>
> Cc: Enric Balletbo i Serra <enric.balletbo@...labora.com>
> Cc: Gwendal Grignou <gwendal@...omium.org>
> Cc: Andy Shevchenko <andy.shevchenko@...il.com>
> Signed-off-by: Stephen Boyd <swboyd@...omium.org>

Acked-by: Benson Leung <bleung@...omium.org>

> ---
>  drivers/mfd/cros_ec_dev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index 1d6dc5c7a19d..d37c79426c87 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -113,10 +113,10 @@ static int cros_ec_check_features(struct cros_ec_dev *ec, int feature)
>  			dev_warn(ec->dev, "cannot get EC features: %d/%d\n",
>  				 ret, msg->result);
>  			memset(ec->features, 0, sizeof(ec->features));
> +		} else {
> +			memcpy(ec->features, msg->data, sizeof(ec->features));
>  		}
>  
> -		memcpy(ec->features, msg->data, sizeof(ec->features));
> -
>  		dev_dbg(ec->dev, "EC features %08x %08x\n",
>  			ec->features[0], ec->features[1]);
>  
> -- 
> Sent by a computer through tubes
> 

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@...gle.com
Chromium OS Project
bleung@...omium.org

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ