Re: net: memory leak in socket

From: Sergei Shtylyov
Date: Wed Jan 10 2018 - 04:30:15 EST


Hello!

On 1/9/2018 11:53 PM, Al Viro wrote:

Argh... Got broken by "make sock_alloc_file() do sock_release() on failures" -
cleanup after sock_map_fd() failure got pulled all the way into sock_alloc_file(),
but it used to serve the case when sock_map_fd() failed *before* getting to
sock_alloc_file().

Fixes: commit 8e1611e23579 (make sock_alloc_file() do sock_release() on failures)
Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

Please add:

Reported-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx>

Sure, no problem. Dave, which tree should that go through? Do you pick it, or
should I send the below directly to Linus?
----
Fix a leak in socket(2) when we fail to allocate a file descriptor.

Got broken by "make sock_alloc_file() do sock_release() on failures" -
cleanup after sock_map_fd() failure got pulled all the way into
sock_alloc_file(), but it used to serve the case when sock_map_fd()
failed *before* getting to sock_alloc_file() as well, and that got
lost. Trivial to fix, fortunately.

Fixes: commit 8e1611e23579 (make sock_alloc_file() do sock_release() on failures)

Fixes: 8e1611e23579 ("make sock_alloc_file() do sock_release() on failures")

Reported-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
[...]

MBR, Sergei