Skip to content

Commit 7ba88b5

Browse files
Denis Arefevalexdeucher
authored andcommitted
drm/amd/pm/smu11: Prevent division by zero
The user can set any speed value. If speed is greater than UINT_MAX/8, division by zero is possible. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 1e866f1 ("drm/amd/pm: Prevent divide by zero") Signed-off-by: Denis Arefev <arefev@swemel.ru> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit da7dc71) Cc: stable@vger.kernel.org
1 parent 35a5440 commit 7ba88b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ int smu_v11_0_set_fan_speed_rpm(struct smu_context *smu,
12041204
uint32_t crystal_clock_freq = 2500;
12051205
uint32_t tach_period;
12061206

1207-
if (speed == 0)
1207+
if (!speed || speed > UINT_MAX/8)
12081208
return -EINVAL;
12091209
/*
12101210
* To prevent from possible overheat, some ASICs may have requirement

0 commit comments

Comments
 (0)