Skip to content

Commit

Permalink
drm/amd/pm/swsmu/smu13/smu_v13_0: Prevent division by zero
Browse files Browse the repository at this point in the history
commit f23e911 upstream.

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: c05d1c4 ("drm/amd/swsmu: add aldebaran smu13 ip support (v3)")
Signed-off-by: Denis Arefev <arefev@swemel.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Denis Arefev authored and Greg Kroah-Hartman committed Apr 25, 2025
1 parent 8e9c4f8 commit fb803d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
Original file line number Diff line number Diff line change
@@ -1228,7 +1228,7 @@ int smu_v13_0_set_fan_speed_rpm(struct smu_context *smu,
uint32_t tach_period;
int ret;

if (!speed)
if (!speed || speed > UINT_MAX/8)
return -EINVAL;

ret = smu_v13_0_auto_fan_control(smu, 0);

0 comments on commit fb803d4

Please sign in to comment.