Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
linux
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martyn Welch
linux
Commits
3b85d302
Commit
3b85d302
authored
6 years ago
by
Al Viro
Browse files
Options
Downloads
Patches
Plain Diff
media: switch to fdget()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
fb386243
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drivers/media/media-request.c
+8
-8
8 additions, 8 deletions
drivers/media/media-request.c
with
8 additions
and
8 deletions
drivers/media/media-request.c
+
8
−
8
View file @
3b85d302
...
...
@@ -246,38 +246,38 @@ static const struct file_operations request_fops = {
struct
media_request
*
media_request_get_by_fd
(
struct
media_device
*
mdev
,
int
request_fd
)
{
struct
f
ile
*
filp
;
struct
f
d
f
;
struct
media_request
*
req
;
if
(
!
mdev
||
!
mdev
->
ops
||
!
mdev
->
ops
->
req_validate
||
!
mdev
->
ops
->
req_queue
)
return
ERR_PTR
(
-
EACCES
);
f
ilp
=
fget
(
request_fd
);
if
(
!
fil
p
)
f
=
f
d
get
(
request_fd
);
if
(
!
f
.
fil
e
)
goto
err_no_req_fd
;
if
(
fil
p
->
f_op
!=
&
request_fops
)
if
(
f
.
fil
e
->
f_op
!=
&
request_fops
)
goto
err_fput
;
req
=
fil
p
->
private_data
;
req
=
f
.
fil
e
->
private_data
;
if
(
req
->
mdev
!=
mdev
)
goto
err_fput
;
/*
* Note: as long as someone has an open filehandle of the request,
* the request can never be released. The fget() above ensures that
* the request can never be released. The f
d
get() above ensures that
* even if userspace closes the request filehandle, the release()
* fop won't be called, so the media_request_get() always succeeds
* and there is no race condition where the request was released
* before media_request_get() is called.
*/
media_request_get
(
req
);
fput
(
f
ilp
);
f
d
put
(
f
);
return
req
;
err_fput:
fput
(
f
ilp
);
f
d
put
(
f
);
err_no_req_fd:
dev_dbg
(
mdev
->
dev
,
"cannot find request_fd %d
\n
"
,
request_fd
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment