Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
4109633f
Commit
4109633f
authored
Aug 26, 2012
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch timerfd_[sg]ettime(2) to fget_light()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
5e196a9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
fs/timerfd.c
fs/timerfd.c
+9
-8
No files found.
fs/timerfd.c
View file @
4109633f
...
...
@@ -234,15 +234,15 @@ static const struct file_operations timerfd_fops = {
.
llseek
=
noop_llseek
,
};
static
struct
file
*
timerfd_fget
(
int
fd
)
static
struct
file
*
timerfd_fget
(
int
fd
,
int
*
fput_needed
)
{
struct
file
*
file
;
file
=
fget
(
f
d
);
file
=
fget
_light
(
fd
,
fput_neede
d
);
if
(
!
file
)
return
ERR_PTR
(
-
EBADF
);
if
(
file
->
f_op
!=
&
timerfd_fops
)
{
fput
(
file
);
fput
_light
(
file
,
*
fput_needed
);
return
ERR_PTR
(
-
EINVAL
);
}
...
...
@@ -287,7 +287,7 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
struct
file
*
file
;
struct
timerfd_ctx
*
ctx
;
struct
itimerspec
ktmr
,
kotmr
;
int
ret
;
int
ret
,
fput_needed
;
if
(
copy_from_user
(
&
ktmr
,
utmr
,
sizeof
(
ktmr
)))
return
-
EFAULT
;
...
...
@@ -297,7 +297,7 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
!
timespec_valid
(
&
ktmr
.
it_interval
))
return
-
EINVAL
;
file
=
timerfd_fget
(
ufd
);
file
=
timerfd_fget
(
ufd
,
&
fput_needed
);
if
(
IS_ERR
(
file
))
return
PTR_ERR
(
file
);
ctx
=
file
->
private_data
;
...
...
@@ -334,7 +334,7 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
ret
=
timerfd_setup
(
ctx
,
flags
,
&
ktmr
);
spin_unlock_irq
(
&
ctx
->
wqh
.
lock
);
fput
(
file
);
fput
_light
(
file
,
fput_needed
);
if
(
otmr
&&
copy_to_user
(
otmr
,
&
kotmr
,
sizeof
(
kotmr
)))
return
-
EFAULT
;
...
...
@@ -346,8 +346,9 @@ SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr)
struct
file
*
file
;
struct
timerfd_ctx
*
ctx
;
struct
itimerspec
kotmr
;
int
fput_needed
;
file
=
timerfd_fget
(
ufd
);
file
=
timerfd_fget
(
ufd
,
&
fput_needed
);
if
(
IS_ERR
(
file
))
return
PTR_ERR
(
file
);
ctx
=
file
->
private_data
;
...
...
@@ -362,7 +363,7 @@ SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr)
kotmr
.
it_value
=
ktime_to_timespec
(
timerfd_get_remaining
(
ctx
));
kotmr
.
it_interval
=
ktime_to_timespec
(
ctx
->
tintv
);
spin_unlock_irq
(
&
ctx
->
wqh
.
lock
);
fput
(
file
);
fput
_light
(
file
,
fput_needed
);
return
copy_to_user
(
otmr
,
&
kotmr
,
sizeof
(
kotmr
))
?
-
EFAULT
:
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment