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: <MWHPR12MB1694B6B916035A508D68F522F7BF0@MWHPR12MB1694.namprd12.prod.outlook.com>
Date:   Tue, 15 Nov 2016 15:49:44 +0000
From:   "Deucher, Alexander" <Alexander.Deucher@....com>
To:     'Colin King' <colin.king@...onical.com>,
        "Koenig, Christian" <Christian.Koenig@....com>,
        David Airlie <airlied@...ux.ie>, "Zhu, Rex" <Rex.Zhu@....com>,
        "StDenis, Tom" <Tom.StDenis@....com>,
        "Huang, Ray" <Ray.Huang@....com>,
        Nils Wallménius <nils.wallmenius@...il.com>,
        Baoyou Xie <baoyou.xie@...aro.org>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] drm/amd/powerplay: check if table_info is NULL before
 dereferencing it

> -----Original Message-----
> From: Colin King [mailto:colin.king@...onical.com]
> Sent: Tuesday, November 15, 2016 7:55 AM
> To: Deucher, Alexander; Koenig, Christian; David Airlie; Zhu, Rex; StDenis,
> Tom; Huang, Ray; Nils Wallménius; Baoyou Xie; dri-
> devel@...ts.freedesktop.org
> Cc: linux-kernel@...r.kernel.org
> Subject: [PATCH] drm/amd/powerplay: check if table_info is NULL before
> dereferencing it
> 
> From: Colin Ian King <colin.king@...onical.com>
> 
> table_info is being dereferenced before a null check, which implies
> a potential null pointer deference error.  Fix this by moving the null
> check of table_info to the start of smu7_get_evv_voltages to avoid
> potential null pointer deferencing.
> 
> Found with static analysis by CoverityScan, CID 1377752
> 
> Signed-off-by: Colin Ian King <colin.king@...onical.com>

NACK, this effectively reverts the patch.  This causes the function to exit early on asics where the table it NULL which is not what we want.  Whether the table exists or not is dependent on the table version and the feature caps for the chip which are checked before the table is dereferenced.  The NULL check in the top if clause is not strictly necessary and could be removed.

Alex

> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> index 28e748d..6798067 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> @@ -1473,6 +1473,8 @@ static int smu7_get_evv_voltages(struct pp_hwmgr
> *hwmgr)
>  			(struct phm_ppt_v1_information *)hwmgr->pptable;
>  	struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table =
> NULL;
> 
> +	if (table_info == NULL)
> +		return -EINVAL;
> 
>  	for (i = 0; i < SMU7_MAX_LEAKAGE_COUNT; i++) {
>  		vv_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i;
> @@ -1483,8 +1485,6 @@ static int smu7_get_evv_voltages(struct pp_hwmgr
> *hwmgr)
>  						table_info-
> >vddgfx_lookup_table, vv_id, &sclk)) {
>  				if (phm_cap_enabled(hwmgr-
> >platform_descriptor.platformCaps,
> 
> 	PHM_PlatformCaps_ClockStretcher)) {
> -					if (table_info == NULL)
> -						return -EINVAL;
>  					sclk_table = table_info-
> >vdd_dep_on_sclk;
> 
>  					for (j = 1; j < sclk_table->count; j++) {
> @@ -1517,8 +1517,6 @@ static int smu7_get_evv_voltages(struct pp_hwmgr
> *hwmgr)
>  					table_info->vddc_lookup_table,
> vv_id, &sclk)) {
>  				if (phm_cap_enabled(hwmgr-
> >platform_descriptor.platformCaps,
> 
> 	PHM_PlatformCaps_ClockStretcher)) {
> -					if (table_info == NULL)
> -						return -EINVAL;
>  					sclk_table = table_info-
> >vdd_dep_on_sclk;
> 
>  					for (j = 1; j < sclk_table->count; j++) {
> --
> 2.10.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ