Commit 0849e3ba authored by Tetsuo Handa's avatar Tetsuo Handa Committed by James Morris

TOMOYO: Add missing poll() hook.

Commit 1dae08c "TOMOYO: Add interactive enforcing mode." forgot to register
poll() hook. As a result, /usr/sbin/tomoyo-queryd was doing busy loop.
Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent e2bf6907
...@@ -1897,6 +1897,23 @@ int tomoyo_open_control(const u8 type, struct file *file) ...@@ -1897,6 +1897,23 @@ int tomoyo_open_control(const u8 type, struct file *file)
return 0; return 0;
} }
/**
* tomoyo_poll_control - poll() for /sys/kernel/security/tomoyo/ interface.
*
* @file: Pointer to "struct file".
* @wait: Pointer to "poll_table".
*
* Waits for read readiness.
* /sys/kernel/security/tomoyo/query is handled by /usr/sbin/tomoyo-queryd .
*/
int tomoyo_poll_control(struct file *file, poll_table *wait)
{
struct tomoyo_io_buffer *head = file->private_data;
if (!head->poll)
return -ENOSYS;
return head->poll(file, wait);
}
/** /**
* tomoyo_read_control - read() for /sys/kernel/security/tomoyo/ interface. * tomoyo_read_control - read() for /sys/kernel/security/tomoyo/ interface.
* *
......
...@@ -705,6 +705,8 @@ void tomoyo_check_profile(void); ...@@ -705,6 +705,8 @@ void tomoyo_check_profile(void);
int tomoyo_open_control(const u8 type, struct file *file); int tomoyo_open_control(const u8 type, struct file *file);
/* Close /sys/kernel/security/tomoyo/ interface. */ /* Close /sys/kernel/security/tomoyo/ interface. */
int tomoyo_close_control(struct file *file); int tomoyo_close_control(struct file *file);
/* Poll operation for /sys/kernel/security/tomoyo/ interface. */
int tomoyo_poll_control(struct file *file, poll_table *wait);
/* Read operation for /sys/kernel/security/tomoyo/ interface. */ /* Read operation for /sys/kernel/security/tomoyo/ interface. */
int tomoyo_read_control(struct file *file, char __user *buffer, int tomoyo_read_control(struct file *file, char __user *buffer,
const int buffer_len); const int buffer_len);
......
...@@ -37,6 +37,19 @@ static int tomoyo_release(struct inode *inode, struct file *file) ...@@ -37,6 +37,19 @@ static int tomoyo_release(struct inode *inode, struct file *file)
return tomoyo_close_control(file); return tomoyo_close_control(file);
} }
/**
* tomoyo_poll - poll() for /proc/ccs/ interface.
*
* @file: Pointer to "struct file".
* @wait: Pointer to "poll_table".
*
* Returns 0 on success, negative value otherwise.
*/
static unsigned int tomoyo_poll(struct file *file, poll_table *wait)
{
return tomoyo_poll_control(file, wait);
}
/** /**
* tomoyo_read - read() for /sys/kernel/security/tomoyo/ interface. * tomoyo_read - read() for /sys/kernel/security/tomoyo/ interface.
* *
...@@ -79,6 +92,7 @@ static ssize_t tomoyo_write(struct file *file, const char __user *buf, ...@@ -79,6 +92,7 @@ static ssize_t tomoyo_write(struct file *file, const char __user *buf,
static const struct file_operations tomoyo_operations = { static const struct file_operations tomoyo_operations = {
.open = tomoyo_open, .open = tomoyo_open,
.release = tomoyo_release, .release = tomoyo_release,
.poll = tomoyo_poll,
.read = tomoyo_read, .read = tomoyo_read,
.write = tomoyo_write, .write = tomoyo_write,
}; };
......
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