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] [day] [month] [year] [list]
Date:   Thu, 5 Jul 2018 16:18:01 +0300
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     Colin King <colin.king@...onical.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, kernel-janitors@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] usb: typec: unlock dp->lock on error exit path,
 and also zero ret if successful

On Wed, Jul 04, 2018 at 01:46:11PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
> 
> One of the error handling paths forgets to unlock dp->lock on the error
> exit path leading to a potential lock-up.  Also the return path for a
> successful call to the function configuration_store can return an
> uninitialized error return code if dp->alt->active is false, so ensure
> ret is zeroed on the successful exit path to avoid garbage being returned.
> 
> Detected by CoverityScan, CID#1471597 ("Unitialized scalar variable")
> 
> Fixes: 0e3bb7d6894d ("usb: typec: Add driver for DisplayPort alternate mode")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>  drivers/usb/typec/altmodes/displayport.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
> index ef12b15bd484..9a637c2b4460 100644
> --- a/drivers/usb/typec/altmodes/displayport.c
> +++ b/drivers/usb/typec/altmodes/displayport.c
> @@ -349,8 +349,10 @@ configuration_store(struct device *dev, struct device_attribute *attr,
>  	cap = DP_CAP_CAPABILITY(dp->alt->vdo);
>  
>  	if ((con == DP_CONF_DFP_D && !(cap & DP_CAP_DFP_D)) ||
> -	    (con == DP_CONF_UFP_D && !(cap & DP_CAP_UFP_D)))
> -		return -EINVAL;
> +	    (con == DP_CONF_UFP_D && !(cap & DP_CAP_UFP_D))) {
> +		ret = -EINVAL;
> +		goto err_unlock;
> +	}
>  
>  	conf = dp->data.conf & ~DP_CONF_DUAL_D;
>  	conf |= con;
> @@ -362,6 +364,7 @@ configuration_store(struct device *dev, struct device_attribute *attr,
>  	}
>  
>  	dp->data.conf = conf;
> +	ret = 0;

Could you set the value when the variable is introduced:

        int ret = 0;


Thank you,

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ