Messages in this thread | | | Date | Mon, 7 Jun 1999 10:44:03 +0100 (BST) | From | Tigran Aivazian <> | Subject | fcheck()/fcheck_task() question. |
| |
Hello,
The <linux/file.h> contains two inlines:
/* * Check whether the specified task has the fd open. Since the task * may not have a files_struct, we must test for p->files != NULL. */ extern inline struct file * fcheck_task(struct task_struct *p, unsigned int fd) { struct file * file = NULL;
if (p->files && fd < p->files->max_fds) file = p->files->fd[fd]; return file; }
/* * Check whether the specified fd has an open file. */ extern inline struct file * fcheck(unsigned int fd) { struct file * file = NULL;
if (fd < current->files->max_fds) file = current->files->fd[fd]; return file; }
Correspondingly, why does fget(fd) use fcheck(fd) and not fcheck_task(fd, current)? If there are any circumstances when p->files == NULL then it should be made clear (e.g. to be used by malicious crackers to panic the system from a simple userspace program). If, however, there is no such possibility then it should also be made clear by removing the check in fcheck_task().
Any thoughts?
Regards, ------ Tigran A. Aivazian | http://www.sco.com Escalations Research Group | tel: +44-(0)1923-813796 Santa Cruz Operation Ltd | http://www.aivazian.demon.co.uk
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |