linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Andrei Vagin <avagin-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org,
	akpm-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	xemul-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org,
	mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	kir-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org,
	Andrey Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>,
	Jason Baron <jbaron-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org>,
	Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>
Subject: Re: [patch 2/3] kcmp: Add KCMP_EPOLL_TFD mode to compare epoll target files
Date: Mon, 13 Mar 2017 21:37:58 +0300	[thread overview]
Message-ID: <20170313183758.GE6743@uranus.lan> (raw)
In-Reply-To: <20170313173723.GA2855-1ViLX0X+lBJGNQ1M2rI3KwRV3xvJKrda@public.gmane.org>

On Mon, Mar 13, 2017 at 10:37:24AM -0700, Andrei Vagin wrote:
> 
> Here is one question inline.
> 
> Acked-by: Andrei Vagin <avagin-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>

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.

      parent reply	other threads:[~2017-03-13 18:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10  8:16 [patch 2/3] kcmp: Add KCMP_EPOLL_TFD mode to compare epoll target files Cyrill Gorcunov
     [not found] ` <20170310082146.103151106-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2017-03-13 14:04   ` Cyrill Gorcunov
2017-03-13 17:37   ` Andrei Vagin
     [not found]     ` <20170313173723.GA2855-1ViLX0X+lBJGNQ1M2rI3KwRV3xvJKrda@public.gmane.org>
2017-03-13 18:37       ` Cyrill Gorcunov [this message]

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=20170313183758.GE6743@uranus.lan \
    --to=gorcunov-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=akpm-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=avagin-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org \
    --cc=avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    --cc=jbaron-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org \
    --cc=kir-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    --cc=xemul-5HdwGun5lf+gSpxsJD1C4w@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;
as well as URLs for NNTP newsgroup(s).