From patchwork Tue Feb 12 01:38:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 10807179 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E20F6C2 for ; Tue, 12 Feb 2019 01:39:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B0532AB4C for ; Tue, 12 Feb 2019 01:39:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F0CB2AB55; Tue, 12 Feb 2019 01:39:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B92432AB4C for ; Tue, 12 Feb 2019 01:38:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726852AbfBLBix (ORCPT ); Mon, 11 Feb 2019 20:38:53 -0500 Received: from icp-osb-irony-out6.external.iinet.net.au ([203.59.1.106]:12135 "EHLO icp-osb-irony-out6.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726079AbfBLBix (ORCPT ); Mon, 11 Feb 2019 20:38:53 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BMAABQI2Jc/4Sh0HYNVhwBAQEEAQEHBAEBgVIGAQELAQGEE4QElFoBAQEGgRCJXY5bgXuEdAMCg2M1CA0BAwEBAQEBAQKBVwEBAQMHBIR6JwRSKAEHBQImAkkWE4UZqwpxfDMaihWBC4FziVx4gQeBRIIqiD+CVwKRBDqRYQmSaQwCilYDh3gBLZ1XA4IJTS4KgyeQamWCWIdbhAMBAQ X-IPAS-Result: A2BMAABQI2Jc/4Sh0HYNVhwBAQEEAQEHBAEBgVIGAQELAQGEE4QElFoBAQEGgRCJXY5bgXuEdAMCg2M1CA0BAwEBAQEBAQKBVwEBAQMHBIR6JwRSKAEHBQImAkkWE4UZqwpxfDMaihWBC4FziVx4gQeBRIIqiD+CVwKRBDqRYQmSaQwCilYDh3gBLZ1XA4IJTS4KgyeQamWCWIdbhAMBAQ X-IronPort-AV: E=Sophos;i="5.58,361,1544457600"; d="scan'208";a="139282751" Received: from unknown (HELO [192.168.1.228]) ([118.208.161.132]) by icp-osb-irony-out6.iinet.net.au with ESMTP; 12 Feb 2019 09:38:32 +0800 Subject: [PATCH] autofs: clear O_NONBLOCK on the pipe. From: Ian Kent To: Andrew Morton Cc: autofs mailing list , linux-fsdevel , Kernel Mailing List , NeilBrown Date: Tue, 12 Feb 2019 09:38:29 +0800 Message-ID: <154993550902.3321.1183632970046073478.stgit@pluto-themaw-net> User-Agent: StGit/unknown-version MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: NeilBrown 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. Signed-off-by: NeilBrown Signed-off-by: Ian Kent --- 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 b735f2b1e462..70c132acdab1 100644 --- a/fs/autofs/autofs_i.h +++ b/fs/autofs/autofs_i.h @@ -216,6 +216,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; }