[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <33bc9c55-cc20-ee6a-2356-86861c271b47@intel.com>
Date: Mon, 14 Dec 2020 10:45:11 +0100
From: Björn Töpel <bjorn.topel@...el.com>
To: Magnus Karlsson <magnus.karlsson@...il.com>,
magnus.karlsson@...el.com, ast@...nel.org, daniel@...earbox.net,
netdev@...r.kernel.org, jonathan.lemon@...il.com
Cc: bpf@...r.kernel.org,
syzbot+cfa88ddd0655afa88763@...kaller.appspotmail.com
Subject: Re: [PATCH bpf] xsk: fix memory leak for failed bind
On 2020-12-14 09:51, Magnus Karlsson wrote:
> From: Magnus Karlsson <magnus.karlsson@...el.com>
>
> Fix a possible memory leak when a bind of an AF_XDP socket fails. When
> the fill and completion rings are created, they are tied to the
> socket. But when the buffer pool is later created at bind time, the
> ownership of these two rings are transferred to the buffer pool as
> they might be shared between sockets (and the buffer pool cannot be
> created until we know what we are binding to). So, before the buffer
> pool is created, these two rings are cleaned up with the socket, and
> after they have been transferred they are cleaned up together with
> the buffer pool.
>
> The problem is that ownership was transferred before it was absolutely
> certain that the buffer pool could be created and initialized
> correctly and when one of these errors occurred, the fill and
> completion rings did neither belong to the socket nor the pool and
> where therefore leaked. Solve this by moving the ownership transfer
> to the point where the buffer pool has been completely set up and
> there is no way it can fail.
>
> Fixes: 7361f9c3d719 ("xsk: Move fill and completion rings to buffer pool")
> Signed-off-by: Magnus Karlsson <magnus.karlsson@...el.com>
> Reported-by: syzbot+cfa88ddd0655afa88763@...kaller.appspotmail.com
Acked-by: Björn Töpel <bjorn.topel@...el.com>
Powered by blists - more mailing lists