Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752521AbcDOPrt (ORCPT ); Fri, 15 Apr 2016 11:47:49 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:37337 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751485AbcDOPqy (ORCPT ); Fri, 15 Apr 2016 11:46:54 -0400 From: "Eric W. Biederman" To: Linus Torvalds Cc: "H. Peter Anvin" , Andy Lutomirski , security@debian.org, security@kernel.org, Al Viro , security@ubuntu.com, Peter Hurley , Serge Hallyn , Willy Tarreau , Aurelien Jarno , One Thousand Gnomes , Jann Horn , Greg KH , Linux Kernel Mailing List , Jiri Slaby , Florian Weimer , "Eric W. Biederman" Date: Fri, 15 Apr 2016 10:35:24 -0500 Message-Id: <1460734532-20134-8-git-send-email-ebiederm@xmission.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1460734532-20134-1-git-send-email-ebiederm@xmission.com> References: <877ffyzy1j.fsf_-_@x220.int.ebiederm.org> <1460734532-20134-1-git-send-email-ebiederm@xmission.com> X-XM-AID: U2FsdGVkX18P4Mn1dJi3NLir3Ey5US/1kTEt6HmsIPA= X-SA-Exim-Connect-IP: 67.3.249.252 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=29] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=29 X-Spam-Combo: **;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 350 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.7 (1.0%), b_tie_ro: 2.6 (0.7%), parse: 0.91 (0.3%), extract_message_metadata: 13 (3.7%), get_uri_detail_list: 1.21 (0.3%), tests_pri_-1000: 7 (2.0%), tests_pri_-950: 1.32 (0.4%), tests_pri_-900: 1.17 (0.3%), tests_pri_-400: 20 (5.8%), check_bayes: 19 (5.4%), b_tokenize: 7 (1.9%), b_tok_get_all: 6 (1.6%), b_comp_prob: 1.67 (0.5%), b_tok_touch_all: 2.9 (0.8%), b_finish: 0.64 (0.2%), tests_pri_0: 289 (82.6%), check_dkim_signature: 0.69 (0.2%), check_dkim_adsp: 3.6 (1.0%), tests_pri_500: 11 (3.1%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 08/16] devpts: Stop rolling devpts_remount by hand in devpts_mount X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1492 Lines: 57 Just use devpts_remount and by doing so ensuring that ptxmode actually get propogated to /dev/pts/ptmx on the initial mount of devpts. Signed-off-by: "Eric W. Biederman" --- fs/devpts/inode.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index d65be43b6fe9..1266abd3251e 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -249,12 +249,6 @@ static int mknod_ptmx(struct super_block *sb) inode_lock(d_inode(root)); - /* If we have already created ptmx node, return */ - if (fsi->ptmx_dentry) { - rc = 0; - goto out; - } - dentry = d_alloc_name(root, "ptmx"); if (!dentry) { pr_err("Unable to alloc dentry for ptmx node\n"); @@ -464,16 +458,20 @@ static struct dentry *devpts_mount(struct file_system_type *fs_type, error = devpts_fill_super(s, data, flags & MS_SILENT ? 1 : 0); if (error) goto out_undo_sget; - s->s_flags |= MS_ACTIVE; - } - error = parse_mount_options(data, &DEVPTS_SB(s)->mount_opts); - if (error) - goto out_undo_sget; + error = parse_mount_options(data, &DEVPTS_SB(s)->mount_opts); + if (error) + goto out_undo_sget; + + error = mknod_ptmx(s); + if (error) + goto out_undo_sget; - error = mknod_ptmx(s); - if (error) - goto out_undo_sget; + s->s_flags |= MS_ACTIVE; + } else { + /* Match mount_single ignore errors on remount */ + devpts_remount(s, &flags, data); + } return dget(s->s_root); -- 2.8.1