Skip to content

Commit de87ba8

Browse files
shubhraamdbp3tk0v
authored andcommitted
EDAC/versal: Check user-supplied data before injecting an error
The function inject_data_ue_store() lacks a NULL check for the user passed values. To prevent below kernel crash include a NULL check. Call trace: kstrtoull kstrtou8 inject_data_ue_store full_proxy_write vfs_write ksys_write __arm64_sys_write invoke_syscall el0_svc_common.constprop.0 do_el0_svc el0_svc el0t_64_sync_handler el0t_64_sync Fixes: 83bf240 ("EDAC/versal: Make the bit position of injected errors configurable") Signed-off-by: Shubhrajyoti Datta <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent edbe594 commit de87ba8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/edac/versal_edac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,9 @@ static ssize_t inject_data_ue_store(struct file *file, const char __user *data,
865865
for (i = 0; i < NUM_UE_BITPOS; i++)
866866
token[i] = strsep(&pbuf, ",");
867867

868+
if (!token[0] || !token[1])
869+
return -EFAULT;
870+
868871
ret = kstrtou8(token[0], 0, &ue0);
869872
if (ret)
870873
return ret;

0 commit comments

Comments
 (0)