diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c index 222ea3f12f41e132f1d14b3ade837bbf205987c5..1ed6d24ae1c945753c2a267efc6f5f3af475b7ef 100644 --- a/drivers/acpi/custom_method.c +++ b/drivers/acpi/custom_method.c @@ -37,6 +37,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;