[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170313183758.GE6743@uranus.lan>
Date: Mon, 13 Mar 2017 21:37:58 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Andrei Vagin <avagin@...tuozzo.com>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-api@...r.kernel.org, viro@...iv.linux.org.uk,
akpm@...uxfoundation.org, xemul@...tuozzo.com,
mtk.manpages@...il.com, kir@...nvz.org,
Andrey Vagin <avagin@...nvz.org>,
Jason Baron <jbaron@...mai.com>,
Andy Lutomirski <luto@...capital.net>
Subject: Re: [patch 2/3] kcmp: Add KCMP_EPOLL_TFD mode to compare epoll
target files
On Mon, Mar 13, 2017 at 10:37:24AM -0700, Andrei Vagin wrote:
>
> Here is one question inline.
>
> Acked-by: Andrei Vagin <avagin@...tuozzo.com>
Thanks!
> > +
> > + files = get_files_struct(task2);
> > + if (!files)
> > + return -EBADF;
> > +
> > + spin_lock(&files->file_lock);
> > + filp_epoll = fcheck_files(files, slot.efd);
> > + if (filp_epoll)
> > + get_file(filp_epoll);
> > + else
> > + filp_tgt = ERR_PTR(-EBADF);
> > + spin_unlock(&files->file_lock);
> > + put_files_struct(files);
>
> Why can we not use fget here ^^^^ ?
Because it's not @current's file table but foreigner process.
So we make sure there is no expand_fdtable in progress and
we test for file descriptor which is being freed.
Powered by blists - more mailing lists