]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amdgpu: Fix NULL dereference in dpm sysfs handlers
authorPaweł Gronowski <me@woland.xyz>
Sun, 19 Jul 2020 15:54:53 +0000 (17:54 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 21 Jul 2020 20:00:01 +0000 (16:00 -0400)
commit21ca9e2c5c444c9478fa5279a866dc2dc94acaf2
tree67209423cb97b92161898d48aa6f268cd9381f2a
parenta1150cea8f5db7f79ec3322a826235eb08a486a7
drm/amdgpu: Fix NULL dereference in dpm sysfs handlers

NULL dereference occurs when string that is not ended with space or
newline is written to some dpm sysfs interface (for example pp_dpm_sclk).
This happens because strsep replaces the tmp with NULL if the delimiter
is not present in string, which is then dereferenced by tmp[0].

Reproduction example:
sudo sh -c 'echo -n 1 > /sys/class/drm/card0/device/pp_dpm_sclk'

Signed-off-by: Paweł Gronowski <me@woland.xyz>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c