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]
Message-ID: <f4371199-63ad-0487-3066-8149d007b416@amd.com>
Date:   Mon, 20 Mar 2023 16:25:21 -0400
From:   Harry Wentland <harry.wentland@....com>
To:     Ville Syrjälä <ville.syrjala@...ux.intel.com>,
        Hamza Mahfooz <hamza.mahfooz@....com>
Cc:     Ian Chen <ian.chen@....com>, Leo Li <sunpeng.li@....com>,
        Qingqing Zhuo <qingqing.zhuo@....com>,
        "Pan, Xinhui" <Xinhui.Pan@....com>,
        Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
        linux-kernel@...r.kernel.org, amd-gfx@...ts.freedesktop.org,
        dri-devel@...ts.freedesktop.org, Wayne Lin <Wayne.Lin@....com>,
        Alex Deucher <alexander.deucher@....com>,
        Christian König <christian.koenig@....com>,
        Sung Joon Kim <sungjoon.kim@....com>
Subject: Re: [PATCH] drm/amd/display: use a more accurate check in
 dm_helpers_dp_read_dpcd()



On 3/10/23 12:51, Ville Syrjälä wrote:
> On Fri, Mar 10, 2023 at 07:48:04PM +0200, Ville Syrjälä wrote:
>> On Thu, Mar 09, 2023 at 04:30:27PM -0500, Hamza Mahfooz wrote:
>>> We should be checking if drm_dp_dpcd_read() returns the size that we are
>>> asking it to read instead of just checking if it is greater than zero.
>>> Also, we should WARN_ON() here since this condition is only ever met, if
>>> there is an issue worth investigating. So, compare the return value of
>>> drm_dp_dpcd_read() to size and WARN_ON() if they aren't equal.
>>>
>>> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@....com>
>>> ---
>>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
>>> index 8d598b322e5b..ed2ed7b1d869 100644
>>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
>>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
>>> @@ -511,8 +511,8 @@ bool dm_helpers_dp_read_dpcd(
>>>  		return false;
>>>  	}
>>>  
>>> -	return drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address,
>>> -			data, size) > 0;
>>> +	return !WARN_ON(drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address,
>>> +					 data, size) != size);
>>
>> Just FYI there are devices out there that violate the DP spec and reads
>> from specific DPCD registers simply fail instead of returning the
>> expected 0.
> 
> And of course anyone can yank the cable anytime, so in
> fact pretty much any DPCD read can fail.
> 

Thanks for making this very important point. It seems like drm_dp_dpcd_access
checks for that, though, and returns -EPROTO if !(ret == size). So I don't
expect this patch to change any behavior.

Harry



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ