Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932536AbcDEBkp (ORCPT ); Mon, 4 Apr 2016 21:40:45 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:58217 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932463AbcDEBkn (ORCPT ); Mon, 4 Apr 2016 21:40:43 -0400 From: "Eric W. Biederman" To: Linus Torvalds Cc: "H. Peter Anvin" , Peter Hurley , Greg KH , Jiri Slaby , Aurelien Jarno , Andy Lutomirski , Florian Weimer , Al Viro , Serge Hallyn , Jann Horn , "security@kernel.org" , security@ubuntu.com, security@debian.org, Willy Tarreau , Linux Kernel Mailing List , "Eric W. Biederman" Date: Mon, 4 Apr 2016 20:29:25 -0500 Message-Id: <1459819769-30387-9-git-send-email-ebiederm@xmission.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1459819769-30387-1-git-send-email-ebiederm@xmission.com> References: <878u0s3orx.fsf_-_@x220.int.ebiederm.org> <1459819769-30387-1-git-send-email-ebiederm@xmission.com> X-XM-AID: U2FsdGVkX189ywsoQI2+L7sY5JnNkig+v4J97S85UOE= 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 * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa03 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 902 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.8 (0.4%), b_tie_ro: 2.7 (0.3%), parse: 1.31 (0.1%), extract_message_metadata: 25 (2.8%), get_uri_detail_list: 1.81 (0.2%), tests_pri_-1000: 11 (1.3%), tests_pri_-950: 1.99 (0.2%), tests_pri_-900: 1.69 (0.2%), tests_pri_-400: 30 (3.4%), check_bayes: 29 (3.2%), b_tokenize: 12 (1.3%), b_tok_get_all: 7 (0.8%), b_comp_prob: 3.4 (0.4%), b_tok_touch_all: 3.2 (0.4%), b_finish: 0.81 (0.1%), tests_pri_0: 814 (90.2%), check_dkim_signature: 0.88 (0.1%), check_dkim_adsp: 4.3 (0.5%), tests_pri_500: 7 (0.8%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 09/13] devpts: Move the creation of /dev/pts/ptmx into fill_super 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 in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1355 Lines: 58 The code makes more sense here and things are just clearer. Signed-off-by: "Eric W. Biederman" --- fs/devpts/inode.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 266a7b7501a6..5356a68863b8 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -379,6 +379,10 @@ static inline void update_ptmx_mode(struct pts_fs_info *fsi) { return; } +static inline int mknod_ptmx(struct super_block *sb) +{ + return 0; +} #endif static int devpts_remount(struct super_block *sb, int *flags, char *data) @@ -491,11 +495,19 @@ devpts_fill_super(struct super_block *s, void *data, int silent) set_nlink(inode, 2); s->s_root = d_make_root(inode); - if (s->s_root) - return 0; + if (!s->s_root) { + pr_err("get root dentry failed\n"); + goto fail; + } - pr_err("get root dentry failed\n"); + error = mknod_ptmx(s); + if (error) + goto fail_dput; + return 0; +fail_dput: + dput(s->s_root); + s->s_root = NULL; fail: return error; } @@ -564,10 +576,6 @@ static struct dentry *devpts_mount(struct file_system_type *fs_type, 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 */ -- 2.6.3