|
@@ -1424,14 +1424,17 @@ static ssize_t cgroup_write_string(struct cgroup *cgrp, struct cftype *cft,
|
|
|
if (buffer == NULL)
|
|
|
return -ENOMEM;
|
|
|
}
|
|
|
- if (nbytes && copy_from_user(buffer, userbuf, nbytes))
|
|
|
- return -EFAULT;
|
|
|
+ if (nbytes && copy_from_user(buffer, userbuf, nbytes)) {
|
|
|
+ retval = -EFAULT;
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
|
|
|
buffer[nbytes] = 0; /* nul-terminate */
|
|
|
strstrip(buffer);
|
|
|
retval = cft->write_string(cgrp, cft, buffer);
|
|
|
if (!retval)
|
|
|
retval = nbytes;
|
|
|
+out:
|
|
|
if (buffer != local_buffer)
|
|
|
kfree(buffer);
|
|
|
return retval;
|