s390/debug: Reject NULL debug info in debug_dump()
PATCH 1/1 s390/debug: Reject NULL debug info in debug_dump()
debug_dump() passes id on to debug_info_copy(), which dereferences in->name unchecked. debug_unregister(), debug_set_size() and debug_register_view() guard against a NULL id but debug_dump() does not. Nothing reaches this today, but add the check for consistency.
--- arch/s390/kernel/debug.c | 3 +++ 1 file changed, 3 insertions(+)
arch/s390/kernel/debug.c +3 -0
@@ -823,6 +823,9 @@ ssize_t debug_dump(debug_info_t *id, struct debug_view *view,file_private_info_t *p_info;size_t size, offset =0 ; +if (!id) +return -EINVAL ; +/* Need space for '\0' byte */ if (buf_size <1 )return 0 ;
Signature · 1 line
2.55.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines
debug_dump()passes id on todebug_info_copy(), which dereferencesin->nameunchecked.debug_unregister(),debug_set_size()anddebug_register_view()guard against a NULL id butdebug_dump()does not. Nothing reaches this today, but add the check for consistency.Reported-by Sashiko <[email protected]>Signed-off-by Mikhail Zaslonko <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 11 lines · Mikhail Zaslonko
debug_dump()passes id on todebug_info_copy(), which dereferencesin->nameunchecked.debug_unregister(),debug_set_size()anddebug_register_view()guard against a NULL id butdebug_dump()does not. Nothing reaches this today, but add the check for consistency.Reported-by Sashiko <[email protected]>Signed-off-by Mikhail Zaslonko <[email protected]>--- arch/s390/kernel/debug.c | 3 +++ 1 file changed, 3 insertions(+)
Applied, thanks!