drm/amdgpu: fix out of bounds write
Quoted 5 lines · Thelford Williams
Size can be any value and is user controlled resulting in overwriting the 40 byte array
wr_bufwith an arbitrary length of data from buf.Signed-off-by Thelford Williams <[email protected]>Signed-off-by Alex Deucher <[email protected]>
The fix works, but unless I am missing something it is incomplete. parse_write_buffer_into_params() is called several times, and the size parameter is always wrong. This patch only fixes one of several instances of the problem.
Guenter
Quoted 19 lines
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +1
-1@@ -264,7 +264,7 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,if (!wr_buf)return -ENOSPC ; -if (parse_write_buffer_into_params (wr_buf, size, +if (parse_write_buffer_into_params (wr_buf, wr_buf_size, (long *)param, buf, max_param_num, ¶m_nums)) {Signature · 1 line
2.33.0
Quoted 4 lines · Guenter Roeck
Quoted 3 lines · Thelford Williams
Size can be any value and is user controlled resulting in overwriting the 40 byte array
wr_bufwith an arbitrary length of data from buf.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Thelford Williams <[email protected]>Signed-off-by Alex Deucher <[email protected]>The fix works, but unless I am missing something it is incomplete.
parse_write_buffer_into_params()is called several times, and the size parameter is always wrong. This patch only fixes one of several instances of the problem.
Patrik sent a patch that covers all cases:
https://patchwork.freedesktop.org/patch/461554/?series=96341&rev=2
Harry
Quoted 21 lines
Guenter
Quoted 19 lines
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +1
-1@@ -264,7 +264,7 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,if (!wr_buf)return -ENOSPC ; -if (parse_write_buffer_into_params (wr_buf, size, +if (parse_write_buffer_into_params (wr_buf, wr_buf_size, (long *)param, buf, max_param_num, ¶m_nums)) {Signature · 1 line
2.33.0
Quoted 14 lines · Harry Wentland
Quoted 4 lines · Guenter Roeck
Quoted 3 lines · Thelford Williams
Size can be any value and is user controlled resulting in overwriting the 40 byte array
wr_bufwith an arbitrary length of data from buf.Quoted 8 lines
Quoted 2 lines
Signed-off-by Thelford Williams <[email protected]>Signed-off-by Alex Deucher <[email protected]>The fix works, but unless I am missing something it is incomplete.
parse_write_buffer_into_params()is called several times, and the size parameter is always wrong. This patch only fixes one of several instances of the problem.
Quoted 5 lines
Patrik sent a patch that covers all cases:
https://patchwork.freedesktop.org/patch/461554/?series=96341&rev=2Harry
Thanks!
Guenter
Quoted 22 lines
Quoted 21 lines
Guenter
Quoted 19 lines
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +1
-1@@ -264,7 +264,7 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,if (!wr_buf)return -ENOSPC ; -if (parse_write_buffer_into_params (wr_buf, size, +if (parse_write_buffer_into_params (wr_buf, wr_buf_size, (long *)param, buf, max_param_num, ¶m_nums)) {Signature · 1 line
2.33.0