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
Kirill Smelkov
linux
Commits
3b85d302
Commit
3b85d302
authored
Apr 14, 2019
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
media: switch to fdget()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
fb386243
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
drivers/media/media-request.c
drivers/media/media-request.c
+8
-8
No files found.
drivers/media/media-request.c
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
=
f
get
(
request_fd
);
if
(
!
f
ilp
)
f
=
fd
get
(
request_fd
);
if
(
!
f
.
file
)
goto
err_no_req_fd
;
if
(
f
ilp
->
f_op
!=
&
request_fops
)
if
(
f
.
file
->
f_op
!=
&
request_fops
)
goto
err_fput
;
req
=
f
ilp
->
private_data
;
req
=
f
.
file
->
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
);
f
put
(
filp
);
f
dput
(
f
);
return
req
;
err_fput:
f
put
(
filp
);
f
dput
(
f
);
err_no_req_fd:
dev_dbg
(
mdev
->
dev
,
"cannot find request_fd %d
\n
"
,
request_fd
);
...
...
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