Commit bd943b31 authored by Lukas Braun's avatar Lukas Braun Committed by Simon Ruderich
Browse files

slsm: try to handle MNT_INTERNAL files

parent 3353b316
......@@ -45,5 +45,18 @@ char *passt_get_path(const struct path *path, char **buf) {
*buf = kzalloc((size_t)buflen, GFP_KERNEL);
if (!*buf)
return ERR_PTR(-ENOMEM);
/* FDs that don't correspond to an actual file, e.g. pipes via /dev/fd,
* aren't resolved to a path by d_absolute_path.
* I *think* these can only be files already opened anyway */
if (path->mnt->mnt_flags & MNT_INTERNAL) {
/* cases we saw of internal FSs were always IS_ROOT, treating them like
* / seems sensible enough */
if (IS_ROOT(path->dentry)) {
*buf[0] = '/';
return *buf;
}
/* no idea what this is */
return ERR_PTR(-EINVAL);
}
return d_absolute_path(path, *buf, buflen);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment