From: Oren Laadan <orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
To: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH] epoll: Check for fdtable races
Date: Fri, 23 Oct 2009 21:03:15 -0400 [thread overview]
Message-ID: <4AE25253.4040100@librato.com> (raw)
In-Reply-To: <1256321658-15646-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
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-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> Cc: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
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
next prev parent reply other threads:[~2009-10-24 1:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-23 18:14 [PATCH] epoll: Check for fdtable races Matt Helsley
[not found] ` <1256321658-15646-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-24 1:03 ` Oren Laadan [this message]
[not found] ` <4AE25253.4040100-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-10-24 3:19 ` Serge E. Hallyn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AE25253.4040100@librato.com \
--to=orenl-rdfvbdnroixbdgjk7y7tuq@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox