Skip to contentSkip to conversation

s390/debug: Reject NULL debug info in debug_dump()

PATCH Applied Mikhail Zaslonko 3 participants 3 messages Sep 16 – Sep 18 s390

lore
Share & tools
lore
#0 lore raw

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
index b5bf8284dbfc..354ce78fc0cf 100644
@@ -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
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines

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.

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
maintainer Applied
#2 lore raw
In reply to Mikhail Zaslonko
Quoted 11 lines · Mikhail Zaslonko

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(+)

Applied, thanks!