diff options
-rw-r--r-- | kernel/cgroup.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 657f8f8d93a5..28debe4e1488 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1424,14 +1424,17 @@ static ssize_t cgroup_write_string(struct cgroup *cgrp, struct cftype *cft, | |||
1424 | if (buffer == NULL) | 1424 | if (buffer == NULL) |
1425 | return -ENOMEM; | 1425 | return -ENOMEM; |
1426 | } | 1426 | } |
1427 | if (nbytes && copy_from_user(buffer, userbuf, nbytes)) | 1427 | if (nbytes && copy_from_user(buffer, userbuf, nbytes)) { |
1428 | return -EFAULT; | 1428 | retval = -EFAULT; |
1429 | goto out; | ||
1430 | } | ||
1429 | 1431 | ||
1430 | buffer[nbytes] = 0; /* nul-terminate */ | 1432 | buffer[nbytes] = 0; /* nul-terminate */ |
1431 | strstrip(buffer); | 1433 | strstrip(buffer); |
1432 | retval = cft->write_string(cgrp, cft, buffer); | 1434 | retval = cft->write_string(cgrp, cft, buffer); |
1433 | if (!retval) | 1435 | if (!retval) |
1434 | retval = nbytes; | 1436 | retval = nbytes; |
1437 | out: | ||
1435 | if (buffer != local_buffer) | 1438 | if (buffer != local_buffer) |
1436 | kfree(buffer); | 1439 | kfree(buffer); |
1437 | return retval; | 1440 | return retval; |