lkml.org 
[lkml]   [2009]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [KVM PATCH v3 2/2] kvm: add support for irqfd via eventfd-notification interface
On Mon, Apr 27, 2009 at 02:33:34PM -0400, Gregory Haskins wrote:
> + /* We re-use eventfd for irqfd */
> + fd = sys_eventfd2(0, 0);
> + if (fd < 0) {
> + ret = fd;
> + goto fail;
> + }
> +
> + /* We maintain a reference to eventfd for the irqfd lifetime */
> + file = eventfd_fget(fd);
> + if (IS_ERR(file)) {
> + ret = PTR_ERR(file);
> + goto fail;
> + }
> +
> + irqfd->file = file;

This is just plain wrong. You have no promise whatsoever that caller of
that sucker won't race with e.g. dup2(). IOW, you can't assume that
file will be of the expected kind.


\
 
 \ /
  Last update: 2009-05-03 08:47    [W:0.142 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site