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: <CADnq5_NywZDO593p7untKwz5J1JuBgCpGDf_tQ9uj_o07Xa8+Q@mail.gmail.com>
Date:   Thu, 2 Nov 2017 16:57:13 -0400
From:   Alex Deucher <alexdeucher@...il.com>
To:     Harry Wentland <harry.wentland@....com>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Alex Deucher <alexander.deucher@....com>,
        Christian König <christian.koenig@....com>,
        David Airlie <airlied@...ux.ie>,
        Horace Chen <horace.chen@....com>,
        LKML <linux-kernel@...r.kernel.org>,
        Maling list - DRI developers 
        <dri-devel@...ts.freedesktop.org>,
        Xiangliang Yu <Xiangliang.Yu@....com>,
        amd-gfx list <amd-gfx@...ts.freedesktop.org>,
        Monk Liu <Monk.Liu@....com>
Subject: Re: [PATCH] drm/amdgpu/virt: don't dereference undefined 'module' struct

On Thu, Nov 2, 2017 at 3:22 PM, Harry Wentland <harry.wentland@....com> wrote:
> On 2017-11-02 07:25 AM, Arnd Bergmann wrote:
>> Accessing the THIS_MODULE directly is only possible when modules
>> are enabled, otherwise we get a build failure:
>>
>> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c: In function 'amdgpu_virt_init_data_exchange':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c:331:20: error: dereferencing pointer to incomplete type 'struct module'
>>
>> Further, THIS_MODULE is NULL when the driver is built-in, so the
>> code would likely cause a NULL pointer dereference.
>>
>> This adds an #ifdef check to avoid the compile-time error, plus
>> a NULL pointer check before dereferencing THIS_MODULE. It might
>> be better to find a way to avoid using the module version
>> altogether.
>>
>> Fixes: 2dc8f81e4f82 ("drm/amdgpu: SR-IOV data exchange between PF&VF")
>> Signed-off-by: Arnd Bergmann <arnd@...db.de>
>
> Looks like 'str' isn't even used here.
>
> Either way, this change by itself is correct and
> Reviewed-by: Harry Wentland <harry.wentland@....com>
>

Applied.  Thanks!

Alex

> Harry
>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>> index e97f80f86005..4e4a476593e8 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>> @@ -328,9 +328,11 @@ void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev)
>>                                       sizeof(amdgim_vf2pf_info));
>>                               AMDGPU_FW_VRAM_VF2PF_READ(adev, driver_version,
>>                                       &str);
>> +#ifdef MODULE
>>                               if (THIS_MODULE->version != NULL)
>>                                       strcpy(str, THIS_MODULE->version);
>>                               else
>> +#endif
>>                                       strcpy(str, "N/A");
>>                               AMDGPU_FW_VRAM_VF2PF_WRITE(adev, driver_cert,
>>                                       0);
>>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ