diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-03 11:02:50 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-24 10:09:32 +0200 |
commit | 2e21a659dac2b74ef5255812b1057ca2973c5aa9 (patch) | |
tree | e9548ece29d34afa1e2d5642947d92374db1bb91 /fs | |
parent | 8b9bbb3aff2bae9ffdee9be0d4537bd395680d35 (diff) | |
download | lwn-2e21a659dac2b74ef5255812b1057ca2973c5aa9.tar.gz lwn-2e21a659dac2b74ef5255812b1057ca2973c5aa9.zip |
devpts: return NULL pts 'priv' entry for non-devpts nodes
commit 3e423945ea94412283eaba8bfbe9d6e0a80b434f upstream.
In commit 8ead9dd54716 ("devpts: more pty driver interface cleanups") I
made devpts_get_priv() just return the dentry->fs_data directly. And
because I thought it wouldn't happen, I added a warning if you ever saw
a pts node that wasn't on devpts.
And no, that warning never triggered under any actual real use, but you
can trigger it by creating nonsensical pts nodes by hand.
So just revert the warning, and make devpts_get_priv() return NULL for
that case like it used to.
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: "Eric W Biederman" <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/devpts/inode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 37c134a132c7..cc543fea5d1e 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -584,7 +584,8 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv) */ void *devpts_get_priv(struct dentry *dentry) { - WARN_ON_ONCE(dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC); + if (dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC) + return NULL; return dentry->d_fsdata; } |