* [PATCH] epoll: Check for fdtable races
@ 2009-10-23 18:14 Matt Helsley
[not found] ` <1256321658-15646-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Matt Helsley @ 2009-10-23 18:14 UTC (permalink / raw)
To: Oren Laadan; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
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>
---
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
--
1.5.6.3
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1256321658-15646-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] epoll: Check for fdtable races [not found] ` <1256321658-15646-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> @ 2009-10-24 1:03 ` Oren Laadan [not found] ` <4AE25253.4040100-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Oren Laadan @ 2009-10-24 1:03 UTC (permalink / raw) To: Matt Helsley; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <4AE25253.4040100-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH] epoll: Check for fdtable races [not found] ` <4AE25253.4040100-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org> @ 2009-10-24 3:19 ` Serge E. Hallyn 0 siblings, 0 replies; 3+ messages in thread From: Serge E. Hallyn @ 2009-10-24 3:19 UTC (permalink / raw) To: Oren Laadan; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA Quoting Oren Laadan (orenl-RdfvBDnrOixBDgjK7y7TUQ@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 :) "Go stand in the corner and don't come out until you'll be NICE to your brother!" -serge ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-24 3:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
[not found] ` <4AE25253.4040100-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-10-24 3:19 ` Serge E. Hallyn
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.