]>
Commit | Line | Data |
---|---|---|
8f69975d BS |
1 | From: Miklos Szeredi <mszeredi@suse.cz> |
2 | Subject: fix oops in d_namespace_path | |
3 | Patch-mainline: no | |
4 | References: bnc#433504 | |
5 | ||
6 | d_namespace_path uses the current->fs->root to get the current | |
7 | namespace. If root is detached root.mnt->mnt_ns will be NULL, causing | |
8 | an Oops. Fix by checking this before dereferencing the mnt_ns. | |
9 | ||
10 | Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> | |
11 | --- | |
12 | fs/namespace.c | 2 +- | |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
14 | ||
15 | --- a/fs/namespace.c | |
16 | +++ b/fs/namespace.c | |
17 | @@ -2312,7 +2312,7 @@ char *d_namespace_path(struct dentry *de | |
18 | path_get(¤t->fs->root); | |
19 | read_unlock(¤t->fs->lock); | |
20 | spin_lock(&vfsmount_lock); | |
21 | - if (root.mnt) | |
22 | + if (root.mnt && root.mnt->mnt_ns) | |
23 | ns_root.mnt = mntget(root.mnt->mnt_ns->root); | |
24 | if (ns_root.mnt) | |
25 | ns_root.dentry = dget(ns_root.mnt->mnt_root); |