Re: [PATCH] server: Fix shm_create_pool size fail path fd leak

2016-03-08 Thread Bryce Harrington
On Mon, Feb 22, 2016 at 02:41:44PM -0800, Bryce Harrington wrote: > On Mon, Feb 22, 2016 at 01:23:00PM +0800, Jonas Ådahl wrote: > > On Fri, Feb 19, 2016 at 11:13:25AM +0100, xerpi wrote: > > > I was just reading the source when I found it (no valgrind involved). So > > > as wl_connection_destroy()

Re: [PATCH] server: Fix shm_create_pool size fail path fd leak

2016-02-26 Thread Pekka Paalanen
On Mon, 22 Feb 2016 14:41:44 -0800 Bryce Harrington wrote: > On Mon, Feb 22, 2016 at 01:23:00PM +0800, Jonas Ådahl wrote: > > On Fri, Feb 19, 2016 at 11:13:25AM +0100, xerpi wrote: > > > I was just reading the source when I found it (no valgrind involved). So > > > as wl_connection_destroy() al

Re: [PATCH] server: Fix shm_create_pool size fail path fd leak

2016-02-22 Thread Bryce Harrington
On Mon, Feb 22, 2016 at 01:23:00PM +0800, Jonas Ådahl wrote: > On Fri, Feb 19, 2016 at 11:13:25AM +0100, xerpi wrote: > > I was just reading the source when I found it (no valgrind involved). So > > as wl_connection_destroy() already takes care of that, my patch is > > pointless. > > I was wrong.

Re: [PATCH] server: Fix shm_create_pool size fail path fd leak

2016-02-21 Thread Jonas Ådahl
On Fri, Feb 19, 2016 at 11:13:25AM +0100, xerpi wrote: > I was just reading the source when I found it (no valgrind involved). So > as wl_connection_destroy() already takes care of that, my patch is > pointless. I was wrong. Your patch is correct, and we do actually leak it. The fd list that is c

Re: [PATCH] server: Fix shm_create_pool size fail path fd leak

2016-02-19 Thread xerpi
I was just reading the source when I found it (no valgrind involved). So as wl_connection_destroy() already takes care of that, my patch is pointless. My final idea would be to add support to fds that have the F_SEAL_SHRINK seal set (see memfd_create(2) and fcntl(2)), so if a client creates shm_po

Re: [PATCH] server: Fix shm_create_pool size fail path fd leak

2016-02-18 Thread Jonas Ådahl
On Thu, Feb 18, 2016 at 11:59:29PM +0100, Sergi Granell wrote: > If the client passed a size <= 0 to shm_create_pool, it would > go to err_free, which wouldn't close the fd, and thus leave it opened. > > We can also move the size check before the struct wl_shm_pool > malloc, so in case the client

[PATCH] server: Fix shm_create_pool size fail path fd leak

2016-02-18 Thread Sergi Granell
If the client passed a size <= 0 to shm_create_pool, it would go to err_free, which wouldn't close the fd, and thus leave it opened. We can also move the size check before the struct wl_shm_pool malloc, so in case the client passes a wrong size, it won't do an unnecessary malloc and then free. ---