Skip to contentSkip to conversation

printk: fix kernel msg leakage in syslog_print_all function;

PATCH Superseded taolan 1 participant 1 message May 5, 2022 Printk

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

taolan

author
#0 lore raw

PATCH 1/1 printk: fix kernel msg leakage in syslog_print_all function;

From: t00264981 <[email protected]>

This function applies for memory but does not initialize the memory,and then invokes copy_to_user to copy the memory to the user space, which causes kernel information leaks.

[ 148.439660] kernel memory leak value 0xffffff80aed972bc at

0xffffffd37f00a000 to 0x704b883e74

---
 kernel/printk/printk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk.c +1 -1
index da03c15ecc89..22d7d821909d 100644
@@ -1591,7 +1591,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
 	u64 seq;
 	bool time;
 
-	text = kmalloc(CONSOLE_LOG_MAX, GFP_KERNEL);
+	text = kzalloc(CONSOLE_LOG_MAX, GFP_KERNEL);
 	if (!text)
 		return -ENOMEM;
 
Signature · 1 line
2.18.0.huawei.25