[Devel] Re: [PATCH] epoll: Check for fdtable races

Oren Laadan orenl at librato.com
Fri Oct 23 18:03:15 PDT 2009



Matt Helsley wrote:
> In case it's possible to race with other tasks sharing the fdtable,
> check for NULL file * and exit with an error.
> 
> Please consider merging this with the first patch in the series
> of epoll patches posted recently.
> 
> Reported-by: "Serge E. Hallyn" <serue at us.ibm.com>
> Signed-off-by: Matt Helsley <matthltc at us.ibm.com>
> Cc: "Serge E. Hallyn" <serue at us.ibm.com>

Already did that when I pulled your patch.

BTW, I chose -EBUSY instead to tell the user to try again
later... when he/she isn't malicious anymore :)

Oren.

> ---
>  fs/eventpoll.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/eventpoll.c b/fs/eventpoll.c
> index c261263..638f9d7 100644
> --- a/fs/eventpoll.c
> +++ b/fs/eventpoll.c
> @@ -1677,7 +1677,8 @@ struct file* ep_file_restore(struct ckpt_ctx *ctx,
>  		return ERR_PTR(epfd);
>  	epfile = fget(epfd);
>  	sys_close(epfd); /* harmless even if an error occured */
> -	BUG_ON(!epfile);
> +	if (!epfile)
> +		return ERR_PTR(-EBADF);
>  
>  	/*
>  	 * Needed before we can properly restore the watches and enforce the
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list