]> git.baikalelectronics.ru Git - kernel.git/commit
umh: fix memory leak on execve failure
authorVincent Minet <v.minet@criteo.com>
Thu, 7 May 2020 22:14:22 +0000 (00:14 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 9 May 2020 02:06:55 +0000 (19:06 -0700)
commit40726c2fbea48577862b73ae647a24e355d47e79
tree538a193dd95f6afe20309e7af2182ec6fd7d6845
parent6cf0c64f8e5f7cfe6b336e41dbdf8a00bb6c6d8b
umh: fix memory leak on execve failure

If a UMH process created by fork_usermode_blob() fails to execute,
a pair of struct file allocated by umh_pipe_setup() will leak.

Under normal conditions, the caller (like bpfilter) needs to manage the
lifetime of the UMH and its two pipes. But when fork_usermode_blob()
fails, the caller doesn't really have a way to know what needs to be
done. It seems better to do the cleanup ourselves in this case.

Fixes: 13d1457c0287 ("umh: introduce fork_usermode_blob() helper")
Signed-off-by: Vincent Minet <v.minet@criteo.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
kernel/umh.c