Commit 48dbef3e authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

sk-unix: unix_process_name -- Defer lookup until required

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent bb9f7cff
...@@ -472,17 +472,8 @@ const struct fdtype_ops unix_dump_ops = { ...@@ -472,17 +472,8 @@ const struct fdtype_ops unix_dump_ops = {
*/ */
static int unix_process_name(struct unix_sk_desc *d, const struct unix_diag_msg *m, struct rtattr **tb) static int unix_process_name(struct unix_sk_desc *d, const struct unix_diag_msg *m, struct rtattr **tb)
{ {
int len, mntns_root;
struct ns_id *ns;
char *name; char *name;
int len;
ns = lookup_ns_by_id(root_item->ids->mnt_ns_id, &mnt_ns_desc);
if (!ns)
return -ENOENT;
mntns_root = mntns_get_root_fd(ns);
if (mntns_root < 0)
return -ENOENT;
len = RTA_PAYLOAD(tb[UNIX_DIAG_NAME]); len = RTA_PAYLOAD(tb[UNIX_DIAG_NAME]);
name = xmalloc(len + 1); name = xmalloc(len + 1);
...@@ -496,13 +487,23 @@ static int unix_process_name(struct unix_sk_desc *d, const struct unix_diag_msg ...@@ -496,13 +487,23 @@ static int unix_process_name(struct unix_sk_desc *d, const struct unix_diag_msg
struct unix_diag_vfs *uv; struct unix_diag_vfs *uv;
bool drop_path = false; bool drop_path = false;
char rpath[PATH_MAX]; char rpath[PATH_MAX];
struct ns_id *ns;
struct stat st; struct stat st;
int mntns_root;
if (!tb[UNIX_DIAG_VFS]) { if (!tb[UNIX_DIAG_VFS]) {
pr_err("Bound socket w/o inode %#x\n", m->udiag_ino); pr_err("Bound socket w/o inode %#x\n", m->udiag_ino);
goto skip; goto skip;
} }
ns = lookup_ns_by_id(root_item->ids->mnt_ns_id, &mnt_ns_desc);
if (!ns)
return -ENOENT;
mntns_root = mntns_get_root_fd(ns);
if (mntns_root < 0)
return -ENOENT;
uv = RTA_DATA(tb[UNIX_DIAG_VFS]); uv = RTA_DATA(tb[UNIX_DIAG_VFS]);
if (name[0] != '/') { if (name[0] != '/') {
/* /*
......
Markdown is supported
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