Commit 1ea03bf8 authored by Pavel Emelyanov's avatar Pavel Emelyanov

fd: Relax file master checking in open and post_open

pid == pid && fd == fd equals fle == fle :)
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent cc41192f
...@@ -381,7 +381,6 @@ static int send_fd_to_self(int fd, struct fdinfo_list_entry *fle, int *sock) ...@@ -381,7 +381,6 @@ static int send_fd_to_self(int fd, struct fdinfo_list_entry *fle, int *sock)
static int post_open_fd(int pid, struct fdinfo_list_entry *fle) static int post_open_fd(int pid, struct fdinfo_list_entry *fle)
{ {
struct file_desc *d = fle->desc; struct file_desc *d = fle->desc;
struct fdinfo_list_entry *flem;
if (!d->ops->post_open) if (!d->ops->post_open)
return 0; return 0;
...@@ -389,11 +388,10 @@ static int post_open_fd(int pid, struct fdinfo_list_entry *fle) ...@@ -389,11 +388,10 @@ static int post_open_fd(int pid, struct fdinfo_list_entry *fle)
if (is_service_fd(fle->fe->fd, CTL_TTY_OFF)) if (is_service_fd(fle->fe->fd, CTL_TTY_OFF))
return d->ops->post_open(d, fle->fe->fd); return d->ops->post_open(d, fle->fe->fd);
flem = file_master(d); if (fle != file_master(d))
if ((flem->pid != pid) || (fle->fe->fd != flem->fe->fd))
return 0; return 0;
return d->ops->post_open(d, flem->fe->fd); return d->ops->post_open(d, fle->fe->fd);
} }
...@@ -430,10 +428,8 @@ static int open_fd(int pid, struct fdinfo_list_entry *fle) ...@@ -430,10 +428,8 @@ static int open_fd(int pid, struct fdinfo_list_entry *fle)
{ {
struct file_desc *d = fle->desc; struct file_desc *d = fle->desc;
int new_fd; int new_fd;
struct fdinfo_list_entry *flem;
flem = file_master(d); if (fle != file_master(d))
if ((flem->pid != pid) || (fle->fe->fd != flem->fe->fd))
return 0; return 0;
new_fd = d->ops->open(d); new_fd = d->ops->open(d);
...@@ -454,7 +450,6 @@ static int receive_fd(int pid, struct fdinfo_list_entry *fle) ...@@ -454,7 +450,6 @@ static int receive_fd(int pid, struct fdinfo_list_entry *fle)
struct fdinfo_list_entry *flem; struct fdinfo_list_entry *flem;
flem = file_master(fle->desc); flem = file_master(fle->desc);
if (flem->pid == pid) if (flem->pid == pid)
return 0; return 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