diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-08-28 12:52:22 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-26 22:20:08 -0400 |
commit | 2903ff019b346ab8d36ebbf54853c3aaf6590608 (patch) | |
tree | 962d94054765bb37bc00e977c3036e65c5fd91fe /fs/eventpoll.c | |
parent | a5b470ba06aa3f96999ede5feba178df6bdb134a (diff) |
switch simple cases of fget_light to fdget
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/eventpoll.c')
-rw-r--r-- | fs/eventpoll.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 567ae72e155d..cd96649bfe62 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -1809,8 +1809,8 @@ error_return: | |||
1809 | SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events, | 1809 | SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events, |
1810 | int, maxevents, int, timeout) | 1810 | int, maxevents, int, timeout) |
1811 | { | 1811 | { |
1812 | int error, fput_needed; | 1812 | int error; |
1813 | struct file *file; | 1813 | struct fd f; |
1814 | struct eventpoll *ep; | 1814 | struct eventpoll *ep; |
1815 | 1815 | ||
1816 | /* The maximum number of event must be greater than zero */ | 1816 | /* The maximum number of event must be greater than zero */ |
@@ -1818,38 +1818,33 @@ SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events, | |||
1818 | return -EINVAL; | 1818 | return -EINVAL; |
1819 | 1819 | ||
1820 | /* Verify that the area passed by the user is writeable */ | 1820 | /* Verify that the area passed by the user is writeable */ |
1821 | if (!access_ok(VERIFY_WRITE, events, maxevents * sizeof(struct epoll_event))) { | 1821 | if (!access_ok(VERIFY_WRITE, events, maxevents * sizeof(struct epoll_event))) |
1822 | error = -EFAULT; | 1822 | return -EFAULT; |
1823 | goto error_return; | ||
1824 | } | ||
1825 | 1823 | ||
1826 | /* Get the "struct file *" for the eventpoll file */ | 1824 | /* Get the "struct file *" for the eventpoll file */ |
1827 | error = -EBADF; | 1825 | f = fdget(epfd); |
1828 | file = fget_light(epfd, &fput_needed); | 1826 | if (!f.file) |
1829 | if (!file) | 1827 | return -EBADF; |
1830 | goto error_return; | ||
1831 | 1828 | ||
1832 | /* | 1829 | /* |
1833 | * We have to check that the file structure underneath the fd | 1830 | * We have to check that the file structure underneath the fd |
1834 | * the user passed to us _is_ an eventpoll file. | 1831 | * the user passed to us _is_ an eventpoll file. |
1835 | */ | 1832 | */ |
1836 | error = -EINVAL; | 1833 | error = -EINVAL; |
1837 | if (!is_file_epoll(file)) | 1834 | if (!is_file_epoll(f.file)) |
1838 | goto error_fput; | 1835 | goto error_fput; |
1839 | 1836 | ||
1840 | /* | 1837 | /* |
1841 | * At this point it is safe to assume that the "private_data" contains | 1838 | * At this point it is safe to assume that the "private_data" contains |
1842 | * our own data structure. | 1839 | * our own data structure. |
1843 | */ | 1840 | */ |
1844 | ep = file->private_data; | 1841 | ep = f.file->private_data; |
1845 | 1842 | ||
1846 | /* Time to fish for events ... */ | 1843 | /* Time to fish for events ... */ |
1847 | error = ep_poll(ep, events, maxevents, timeout); | 1844 | error = ep_poll(ep, events, maxevents, timeout); |
1848 | 1845 | ||
1849 | error_fput: | 1846 | error_fput: |
1850 | fput_light(file, fput_needed); | 1847 | fdput(f); |
1851 | error_return: | ||
1852 | |||
1853 | return error; | 1848 | return error; |
1854 | } | 1849 | } |
1855 | 1850 | ||