From: Ian Kent <raven@themaw.net>
To: NeilBrown <neilb@suse.com>, Andrew Morton <akpm@linux-foundation.org>
Cc: autofs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] autofs: clear O_NONBLOCK on the pipe.
Date: Mon, 11 Feb 2019 13:31:43 +0800 [thread overview]
Message-ID: <dddb59ed3d0bc790bea9424784998e2ab264d75b.camel@themaw.net> (raw)
In-Reply-To: <871s4fi5b5.fsf@notabene.neil.brown.name>
On Mon, 2019-02-11 at 10:37 +1100, NeilBrown wrote:
> autofs does not expect the pipe it is given
> to have O_NONBLOCK set - specifically if __kernel_write()
> in autofs_write() returns -EAGAIN, this is treated
> as a fatal error and the pipe is closed.
>
> For safety autofs should, therefore, clear the O_NONBLOCK flag.
>
> Releases of systemd prior to 8th February 2019 used
> pipe2(p, O_NONBLOCK|O_CLOEXEC)
> and thus (inadvertently) set this flag.
Thanks Neil, this does look like an obvious problem.
>
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
> fs/autofs/autofs_i.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h
> index 3e59f0ed777b..331192bed0d5 100644
> --- a/fs/autofs/autofs_i.h
> +++ b/fs/autofs/autofs_i.h
> @@ -215,6 +215,8 @@ static inline int autofs_prepare_pipe(struct file *pipe)
> return -EINVAL;
> /* We want a packet pipe */
> pipe->f_flags |= O_DIRECT;
> + /* We don't expect -EAGAIN */
> + pipe->f_flags &= ~O_NONBLOCK;
> return 0;
> }
>
next prev parent reply other threads:[~2019-02-11 5:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-10 23:37 NeilBrown
2019-02-11 5:31 ` Ian Kent [this message]
2019-02-12 1:38 Ian Kent
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=dddb59ed3d0bc790bea9424784998e2ab264d75b.camel@themaw.net \
--to=raven@themaw.net \
--cc=akpm@linux-foundation.org \
--cc=autofs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.com \
/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
all inboxes | Powered by JetHome®