Skip to content

Commit 3b85d30

Browse files
author
Al Viro
committed
media: switch to fdget()
Signed-off-by: Al Viro <[email protected]>
1 parent fb38624 commit 3b85d30

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/media/media-request.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,38 +246,38 @@ static const struct file_operations request_fops = {
246246
struct media_request *
247247
media_request_get_by_fd(struct media_device *mdev, int request_fd)
248248
{
249-
struct file *filp;
249+
struct fd f;
250250
struct media_request *req;
251251

252252
if (!mdev || !mdev->ops ||
253253
!mdev->ops->req_validate || !mdev->ops->req_queue)
254254
return ERR_PTR(-EACCES);
255255

256-
filp = fget(request_fd);
257-
if (!filp)
256+
f = fdget(request_fd);
257+
if (!f.file)
258258
goto err_no_req_fd;
259259

260-
if (filp->f_op != &request_fops)
260+
if (f.file->f_op != &request_fops)
261261
goto err_fput;
262-
req = filp->private_data;
262+
req = f.file->private_data;
263263
if (req->mdev != mdev)
264264
goto err_fput;
265265

266266
/*
267267
* Note: as long as someone has an open filehandle of the request,
268-
* the request can never be released. The fget() above ensures that
268+
* the request can never be released. The fdget() above ensures that
269269
* even if userspace closes the request filehandle, the release()
270270
* fop won't be called, so the media_request_get() always succeeds
271271
* and there is no race condition where the request was released
272272
* before media_request_get() is called.
273273
*/
274274
media_request_get(req);
275-
fput(filp);
275+
fdput(f);
276276

277277
return req;
278278

279279
err_fput:
280-
fput(filp);
280+
fdput(f);
281281

282282
err_no_req_fd:
283283
dev_dbg(mdev->dev, "cannot find request_fd %d\n", request_fd);

0 commit comments

Comments
 (0)