The patch titled cgroup: fix possible memory leak has been added to the -mm tree. Its filename is cgroup-fix-possible-memory-leak.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: cgroup: fix possible memory leak From: Li Zefan <lizf@xxxxxxxxxxxxxx> There's a leak if copy_from_user() returns failure. Signed-off-by: Li Zefan <lizf@xxxxxxxxxxxxxx> Cc: Paul Menage <menage@xxxxxxxxxx> Cc: Cedric Le Goater <clg@xxxxxxxxxx> Cc: Balbir Singh <balbir@xxxxxxxxxx> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/cgroup.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff -puN kernel/cgroup.c~cgroup-fix-possible-memory-leak kernel/cgroup.c --- a/kernel/cgroup.c~cgroup-fix-possible-memory-leak +++ a/kernel/cgroup.c @@ -1423,14 +1423,17 @@ static ssize_t cgroup_write_string(struc 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; _ Patches currently in -mm which might be from lizf@xxxxxxxxxxxxxx are origin.patch linux-next.patch cgroup-fix-possible-memory-leak.patch cgroup-remove-duplicate-code-in-allocate_cg_link.patch cgroup-uninline-cgroup_has_css_refs.patch memcg-remove-redundant-check-in-move_task.patch memrlimit-add-memrlimit-controller-documentation.patch memrlimit-setup-the-memrlimit-controller.patch memrlimit-cgroup-mm-owner-callback-changes-to-add-task-info.patch memrlimit-add-memrlimit-controller-accounting-and-control.patch memrlimit-improve-error-handling.patch memrlimit-improve-error-handling-update.patch memrlimit-handle-attach_task-failure-add-can_attach-callback.patch introduce-__get_user_pages.patch introduce-__get_user_pages-fix.patch split-lru-munlock-rework.patch revert-to-unevictable-lru-infrastructure-kconfig-fixpatch.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html