diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c index fa9f7ff4a3a6a506f4918f6838f96e5b1cc35d9a..4058e024109171b78483a841b6aad58aea7e0b8b 100644 --- a/drivers/acpi/custom_method.c +++ b/drivers/acpi/custom_method.c @@ -42,6 +42,8 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, sizeof(struct acpi_table_header))) return -EFAULT; uncopied_bytes = max_size = table.length; + /* make sure the buf is not allocated */ + kfree(buf); buf = kzalloc(max_size, GFP_KERNEL); if (!buf) return -ENOMEM;