int error;
 
        flags |= profile->path_flags | (S_ISDIR(cond->mode) ? PATH_IS_DIR : 0);
-       error = aa_path_name(path, flags, &buffer, &name, &info);
+       error = aa_path_name(path, flags, &buffer, &name, &info,
+                            profile->disconnected);
        if (error) {
                if (error == -ENOENT && is_deleted(path->dentry)) {
                        /* Access to open files that are deleted are
 
        /* buffer freed below, lname is pointer in buffer */
        error = aa_path_name(&link, profile->path_flags, &buffer, &lname,
-                            &info);
+                            &info, profile->disconnected);
        if (error)
                goto audit;
 
        /* buffer2 freed below, tname is pointer in buffer2 */
        error = aa_path_name(&target, profile->path_flags, &buffer2, &tname,
-                            &info);
+                            &info, profile->disconnected);
        if (error)
                goto audit;
 
 
  *     namespace root.
  */
 static int disconnect(const struct path *path, char *buf, char **name,
-                     int flags)
+                     int flags, const char *disconnected)
 {
        int error = 0;
 
                error = -EACCES;
                if (**name == '/')
                        *name = *name + 1;
-       } else if (**name != '/')
-               /* CONNECT_PATH with missing root */
-               error = prepend(name, *name - buf, "/", 1);
+       } else {
+               if (**name != '/')
+                       /* CONNECT_PATH with missing root */
+                       error = prepend(name, *name - buf, "/", 1);
+               if (!error && disconnected)
+                       error = prepend(name, *name - buf, disconnected,
+                                       strlen(disconnected));
+       }
 
        return error;
 }
  * @buflen: length of @buf
  * @name: Returns - pointer for start of path name with in @buf (NOT NULL)
  * @flags: flags controlling path lookup
+ * @disconnected: string to prefix to disconnected paths
  *
  * Handle path name lookup.
  *
  *          to a position in @buf
  */
 static int d_namespace_path(const struct path *path, char *buf, int buflen,
-                           char **name, int flags)
+                           char **name, int flags, const char *disconnected)
 {
        char *res;
        int error = 0;
                         */
                        return prepend(name, *name - buf, "/proc", 5);
                } else
-                       return disconnect(path, buf, name, flags);
-               return 0;
+                       return disconnect(path, buf, name, flags,
+                                         disconnected);
        }
 
        /* resolve paths relative to chroot?*/
        }
 
        if (!connected)
-               error = disconnect(path, buf, name, flags);
+               error = disconnect(path, buf, name, flags, disconnected);
 
 out:
        return error;
  * Returns: %0 else error on failure
  */
 static int get_name_to_buffer(const struct path *path, int flags, char *buffer,
-                             int size, char **name, const char **info)
+                             int size, char **name, const char **info,
+                             const char *disconnected)
 {
        int adjust = (flags & PATH_IS_DIR) ? 1 : 0;
-       int error = d_namespace_path(path, buffer, size - adjust, name, flags);
+       int error = d_namespace_path(path, buffer, size - adjust, name, flags,
+                                    disconnected);
 
        if (!error && (flags & PATH_IS_DIR) && (*name)[1] != '\0')
                /*
  * @buffer: buffer that aa_get_name() allocated  (NOT NULL)
  * @name: Returns - the generated path name if !error (NOT NULL)
  * @info: Returns - information on why the path lookup failed (MAYBE NULL)
+ * @disconnected: string to prepend to disconnected paths
  *
  * @name is a pointer to the beginning of the pathname (which usually differs
  * from the beginning of the buffer), or NULL.  If there is an error @name
  * Returns: %0 else error code if could retrieve name
  */
 int aa_path_name(const struct path *path, int flags, char **buffer,
-                const char **name, const char **info)
+                const char **name, const char **info, const char *disconnected)
 {
        char *buf, *str = NULL;
        int size = 256;
                if (!buf)
                        return -ENOMEM;
 
-               error = get_name_to_buffer(path, flags, buf, size, &str, info);
+               error = get_name_to_buffer(path, flags, buf, size, &str, info,
+                                          disconnected);
                if (error != -ENAMETOOLONG)
                        break;