diff options
author | Shubhrajyoti Datta | 2024-04-25 17:49:41 +0530 |
---|---|---|
committer | Borislav Petkov (AMD) | 2024-04-25 18:04:47 +0200 |
commit | de87ba848d5e4c861b7357dd7a91698aed7a5a18 (patch) | |
tree | 5424bf069743025200c00af331b839923a6780c2 /drivers/edac | |
parent | edbe59428eb0da09958769326a6566d4c9242ae7 (diff) |
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: 83bf24051a60 ("EDAC/versal: Make the bit position of injected errors configurable")
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20240425121942.26378-3-shubhrajyoti.datta@amd.com
Diffstat (limited to 'drivers/edac')
-rw-r--r-- | drivers/edac/versal_edac.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/edac/versal_edac.c b/drivers/edac/versal_edac.c index 873e7377a105..0c50afafc3e2 100644 --- a/drivers/edac/versal_edac.c +++ b/drivers/edac/versal_edac.c @@ -865,6 +865,9 @@ static ssize_t inject_data_ue_store(struct file *file, const char __user *data, for (i = 0; i < NUM_UE_BITPOS; i++) token[i] = strsep(&pbuf, ","); + if (!token[0] || !token[1]) + return -EFAULT; + ret = kstrtou8(token[0], 0, &ue0); if (ret) return ret; |