mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
drm/amdgpu/atom: Check kcalloc() for WS buffer in amdgpu_atom_execute_table_locked()
kcalloc() may fail. When WS is non-zero and allocation fails, ectx.ws remains NULL while ectx.ws_size is set, leading to a potential NULL pointer dereference in atom_get_src_int() when accessing WS entries. Return -ENOMEM on allocation failure to avoid the NULL dereference. Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
59e4405e9e
commit
cc9a8e238e
|
|
@ -1246,6 +1246,10 @@ static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index,
|
|||
ectx.last_jump_jiffies = 0;
|
||||
if (ws) {
|
||||
ectx.ws = kcalloc(4, ws, GFP_KERNEL);
|
||||
if (!ectx.ws) {
|
||||
ret = -ENOMEM;
|
||||
goto free;
|
||||
}
|
||||
ectx.ws_size = ws;
|
||||
} else {
|
||||
ectx.ws = NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user