Skip to contentSkip to conversation

driver: acpi: fix the memory leak issue in the cm_write() function.

PATCH New shiqiang.deng 1 participant 1 message Nov 3, 2023 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver: acpi: fix the memory leak issue in the cm_write() function.

In the cm_write() function, memory is allocated, and at the end of the function when uncopied_bytes is 0, the memory is freed. If uncopied_bytes is not equal to 0, a memory leak occurs.

---
 drivers/acpi/custom_method.c | 1 +
 1 file changed, 1 insertion(+)
drivers/acpi/custom_method.c +1 -0
index d39a9b474..70132d291 100644
@@ -79,6 +79,7 @@ static ssize_t cm_write(struct file *file, const char __user *user_buf,
 		add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE);
 	}
 
+	kfree(buf);
 	return count;
 }
 
Signature · 1 line
2.30.0