Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
ipipe
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xenomai
ipipe
Commits
2903ff01
Commit
2903ff01
authored
Aug 28, 2012
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch simple cases of fget_light to fdget
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
a5b470ba
Changes
44
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
633 additions
and
763 deletions
+633
-763
arch/alpha/kernel/osf_sys.c
arch/alpha/kernel/osf_sys.c
+6
-9
arch/ia64/kernel/perfmon.c
arch/ia64/kernel/perfmon.c
+7
-8
arch/parisc/hpux/fs.c
arch/parisc/hpux/fs.c
+8
-9
arch/powerpc/platforms/cell/spu_syscalls.c
arch/powerpc/platforms/cell/spu_syscalls.c
+9
-12
drivers/infiniband/core/ucma.c
drivers/infiniband/core/ucma.c
+6
-6
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/uverbs_cmd.c
+9
-9
drivers/infiniband/core/uverbs_main.c
drivers/infiniband/core/uverbs_main.c
+5
-7
drivers/vfio/vfio.c
drivers/vfio/vfio.c
+8
-9
drivers/video/msm/mdp.c
drivers/video/msm/mdp.c
+5
-7
fs/btrfs/ioctl.c
fs/btrfs/ioctl.c
+12
-14
fs/coda/inode.c
fs/coda/inode.c
+7
-7
fs/compat.c
fs/compat.c
+40
-50
fs/compat_ioctl.c
fs/compat_ioctl.c
+12
-15
fs/eventpoll.c
fs/eventpoll.c
+10
-15
fs/ext4/ioctl.c
fs/ext4/ioctl.c
+7
-7
fs/fcntl.c
fs/fcntl.c
+14
-18
fs/fhandle.c
fs/fhandle.c
+7
-10
fs/ioctl.c
fs/ioctl.c
+9
-16
fs/locks.c
fs/locks.c
+9
-11
fs/namei.c
fs/namei.c
+17
-22
fs/notify/fanotify/fanotify_user.c
fs/notify/fanotify/fanotify_user.c
+13
-15
fs/notify/inotify/inotify_user.c
fs/notify/inotify/inotify_user.c
+14
-14
fs/ocfs2/cluster/heartbeat.c
fs/ocfs2/cluster/heartbeat.c
+19
-20
fs/open.c
fs/open.c
+30
-34
fs/read_write.c
fs/read_write.c
+77
-99
fs/readdir.c
fs/readdir.c
+16
-20
fs/select.c
fs/select.c
+12
-16
fs/signalfd.c
fs/signalfd.c
+6
-7
fs/splice.c
fs/splice.c
+32
-37
fs/stat.c
fs/stat.c
+5
-5
fs/statfs.c
fs/statfs.c
+4
-5
fs/sync.c
fs/sync.c
+14
-19
fs/timerfd.c
fs/timerfd.c
+22
-26
fs/utimes.c
fs/utimes.c
+5
-6
fs/xattr.c
fs/xattr.c
+22
-30
fs/xfs/xfs_dfrag.c
fs/xfs/xfs_dfrag.c
+18
-18
fs/xfs/xfs_ioctl.c
fs/xfs/xfs_ioctl.c
+6
-6
include/linux/file.h
include/linux/file.h
+3
-2
ipc/mqueue.c
ipc/mqueue.c
+41
-43
kernel/events/core.c
kernel/events/core.c
+30
-40
kernel/sys.c
kernel/sys.c
+8
-8
kernel/taskstats.c
kernel/taskstats.c
+5
-6
mm/fadvise.c
mm/fadvise.c
+17
-18
mm/readahead.c
mm/readahead.c
+7
-8
No files found.
arch/alpha/kernel/osf_sys.c
View file @
2903ff01
...
@@ -144,28 +144,25 @@ SYSCALL_DEFINE4(osf_getdirentries, unsigned int, fd,
...
@@ -144,28 +144,25 @@ SYSCALL_DEFINE4(osf_getdirentries, unsigned int, fd,
struct
osf_dirent
__user
*
,
dirent
,
unsigned
int
,
count
,
struct
osf_dirent
__user
*
,
dirent
,
unsigned
int
,
count
,
long
__user
*
,
basep
)
long
__user
*
,
basep
)
{
{
int
error
,
fput_needed
;
int
error
;
struct
f
ile
*
file
;
struct
f
d
arg
=
fdget
(
fd
)
;
struct
osf_dirent_callback
buf
;
struct
osf_dirent_callback
buf
;
error
=
-
EBADF
;
if
(
!
arg
.
file
)
file
=
fget_light
(
fd
,
&
fput_needed
);
return
-
EBADF
;
if
(
!
file
)
goto
out
;
buf
.
dirent
=
dirent
;
buf
.
dirent
=
dirent
;
buf
.
basep
=
basep
;
buf
.
basep
=
basep
;
buf
.
count
=
count
;
buf
.
count
=
count
;
buf
.
error
=
0
;
buf
.
error
=
0
;
error
=
vfs_readdir
(
file
,
osf_filldir
,
&
buf
);
error
=
vfs_readdir
(
arg
.
file
,
osf_filldir
,
&
buf
);
if
(
error
>=
0
)
if
(
error
>=
0
)
error
=
buf
.
error
;
error
=
buf
.
error
;
if
(
count
!=
buf
.
count
)
if
(
count
!=
buf
.
count
)
error
=
count
-
buf
.
count
;
error
=
count
-
buf
.
count
;
fput_light
(
file
,
fput_needed
);
fdput
(
arg
);
out:
return
error
;
return
error
;
}
}
...
...
arch/ia64/kernel/perfmon.c
View file @
2903ff01
...
@@ -4780,7 +4780,7 @@ recheck:
...
@@ -4780,7 +4780,7 @@ recheck:
asmlinkage
long
asmlinkage
long
sys_perfmonctl
(
int
fd
,
int
cmd
,
void
__user
*
arg
,
int
count
)
sys_perfmonctl
(
int
fd
,
int
cmd
,
void
__user
*
arg
,
int
count
)
{
{
struct
f
ile
*
file
=
NULL
;
struct
f
d
f
=
{
NULL
,
0
}
;
pfm_context_t
*
ctx
=
NULL
;
pfm_context_t
*
ctx
=
NULL
;
unsigned
long
flags
=
0UL
;
unsigned
long
flags
=
0UL
;
void
*
args_k
=
NULL
;
void
*
args_k
=
NULL
;
...
@@ -4789,7 +4789,6 @@ sys_perfmonctl (int fd, int cmd, void __user *arg, int count)
...
@@ -4789,7 +4789,6 @@ sys_perfmonctl (int fd, int cmd, void __user *arg, int count)
int
narg
,
completed_args
=
0
,
call_made
=
0
,
cmd_flags
;
int
narg
,
completed_args
=
0
,
call_made
=
0
,
cmd_flags
;
int
(
*
func
)(
pfm_context_t
*
ctx
,
void
*
arg
,
int
count
,
struct
pt_regs
*
regs
);
int
(
*
func
)(
pfm_context_t
*
ctx
,
void
*
arg
,
int
count
,
struct
pt_regs
*
regs
);
int
(
*
getsize
)(
void
*
arg
,
size_t
*
sz
);
int
(
*
getsize
)(
void
*
arg
,
size_t
*
sz
);
int
fput_needed
;
#define PFM_MAX_ARGSIZE 4096
#define PFM_MAX_ARGSIZE 4096
/*
/*
...
@@ -4878,17 +4877,17 @@ restart_args:
...
@@ -4878,17 +4877,17 @@ restart_args:
ret
=
-
EBADF
;
ret
=
-
EBADF
;
f
ile
=
fget_light
(
fd
,
&
fput_neede
d
);
f
=
fdget
(
f
d
);
if
(
unlikely
(
file
==
NULL
))
{
if
(
unlikely
(
f
.
f
ile
==
NULL
))
{
DPRINT
((
"invalid fd %d
\n
"
,
fd
));
DPRINT
((
"invalid fd %d
\n
"
,
fd
));
goto
error_args
;
goto
error_args
;
}
}
if
(
unlikely
(
PFM_IS_FILE
(
file
)
==
0
))
{
if
(
unlikely
(
PFM_IS_FILE
(
f
.
f
ile
)
==
0
))
{
DPRINT
((
"fd %d not related to perfmon
\n
"
,
fd
));
DPRINT
((
"fd %d not related to perfmon
\n
"
,
fd
));
goto
error_args
;
goto
error_args
;
}
}
ctx
=
file
->
private_data
;
ctx
=
f
.
f
ile
->
private_data
;
if
(
unlikely
(
ctx
==
NULL
))
{
if
(
unlikely
(
ctx
==
NULL
))
{
DPRINT
((
"no context for fd %d
\n
"
,
fd
));
DPRINT
((
"no context for fd %d
\n
"
,
fd
));
goto
error_args
;
goto
error_args
;
...
@@ -4918,8 +4917,8 @@ abort_locked:
...
@@ -4918,8 +4917,8 @@ abort_locked:
if
(
call_made
&&
PFM_CMD_RW_ARG
(
cmd
)
&&
copy_to_user
(
arg
,
args_k
,
base_sz
*
count
))
ret
=
-
EFAULT
;
if
(
call_made
&&
PFM_CMD_RW_ARG
(
cmd
)
&&
copy_to_user
(
arg
,
args_k
,
base_sz
*
count
))
ret
=
-
EFAULT
;
error_args:
error_args:
if
(
file
)
if
(
f
.
f
ile
)
f
put_light
(
file
,
fput_needed
);
f
dput
(
f
);
kfree
(
args_k
);
kfree
(
args_k
);
...
...
arch/parisc/hpux/fs.c
View file @
2903ff01
...
@@ -109,33 +109,32 @@ Efault:
...
@@ -109,33 +109,32 @@ Efault:
int
hpux_getdents
(
unsigned
int
fd
,
struct
hpux_dirent
__user
*
dirent
,
unsigned
int
count
)
int
hpux_getdents
(
unsigned
int
fd
,
struct
hpux_dirent
__user
*
dirent
,
unsigned
int
count
)
{
{
struct
f
ile
*
file
;
struct
f
d
arg
;
struct
hpux_dirent
__user
*
lastdirent
;
struct
hpux_dirent
__user
*
lastdirent
;
struct
getdents_callback
buf
;
struct
getdents_callback
buf
;
int
error
=
-
EBADF
,
fput_needed
;
int
error
;
file
=
fget_light
(
fd
,
&
fput_neede
d
);
arg
=
fdget
(
f
d
);
if
(
!
file
)
if
(
!
arg
.
file
)
goto
out
;
return
-
EBADF
;
buf
.
current_dir
=
dirent
;
buf
.
current_dir
=
dirent
;
buf
.
previous
=
NULL
;
buf
.
previous
=
NULL
;
buf
.
count
=
count
;
buf
.
count
=
count
;
buf
.
error
=
0
;
buf
.
error
=
0
;
error
=
vfs_readdir
(
file
,
filldir
,
&
buf
);
error
=
vfs_readdir
(
arg
.
file
,
filldir
,
&
buf
);
if
(
error
>=
0
)
if
(
error
>=
0
)
error
=
buf
.
error
;
error
=
buf
.
error
;
lastdirent
=
buf
.
previous
;
lastdirent
=
buf
.
previous
;
if
(
lastdirent
)
{
if
(
lastdirent
)
{
if
(
put_user
(
file
->
f_pos
,
&
lastdirent
->
d_off
))
if
(
put_user
(
arg
.
file
->
f_pos
,
&
lastdirent
->
d_off
))
error
=
-
EFAULT
;
error
=
-
EFAULT
;
else
else
error
=
count
-
buf
.
count
;
error
=
count
-
buf
.
count
;
}
}
fput_light
(
file
,
fput_needed
);
fdput
(
arg
);
out:
return
error
;
return
error
;
}
}
...
...
arch/powerpc/platforms/cell/spu_syscalls.c
View file @
2903ff01
...
@@ -69,8 +69,6 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
...
@@ -69,8 +69,6 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
umode_t
,
mode
,
int
,
neighbor_fd
)
umode_t
,
mode
,
int
,
neighbor_fd
)
{
{
long
ret
;
long
ret
;
struct
file
*
neighbor
;
int
fput_needed
;
struct
spufs_calls
*
calls
;
struct
spufs_calls
*
calls
;
calls
=
spufs_calls_get
();
calls
=
spufs_calls_get
();
...
@@ -78,11 +76,11 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
...
@@ -78,11 +76,11 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
return
-
ENOSYS
;
return
-
ENOSYS
;
if
(
flags
&
SPU_CREATE_AFFINITY_SPU
)
{
if
(
flags
&
SPU_CREATE_AFFINITY_SPU
)
{
struct
fd
neighbor
=
fdget
(
neighbor_fd
);
ret
=
-
EBADF
;
ret
=
-
EBADF
;
neighbor
=
fget_light
(
neighbor_fd
,
&
fput_needed
);
if
(
neighbor
.
file
)
{
if
(
neighbor
)
{
ret
=
calls
->
create_thread
(
name
,
flags
,
mode
,
neighbor
.
file
);
ret
=
calls
->
create_thread
(
name
,
flags
,
mode
,
neighbor
);
fdput
(
neighbor
);
fput_light
(
neighbor
,
fput_needed
);
}
}
}
else
}
else
ret
=
calls
->
create_thread
(
name
,
flags
,
mode
,
NULL
);
ret
=
calls
->
create_thread
(
name
,
flags
,
mode
,
NULL
);
...
@@ -94,8 +92,7 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
...
@@ -94,8 +92,7 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
asmlinkage
long
sys_spu_run
(
int
fd
,
__u32
__user
*
unpc
,
__u32
__user
*
ustatus
)
asmlinkage
long
sys_spu_run
(
int
fd
,
__u32
__user
*
unpc
,
__u32
__user
*
ustatus
)
{
{
long
ret
;
long
ret
;
struct
file
*
filp
;
struct
fd
arg
;
int
fput_needed
;
struct
spufs_calls
*
calls
;
struct
spufs_calls
*
calls
;
calls
=
spufs_calls_get
();
calls
=
spufs_calls_get
();
...
@@ -103,10 +100,10 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus)
...
@@ -103,10 +100,10 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus)
return
-
ENOSYS
;
return
-
ENOSYS
;
ret
=
-
EBADF
;
ret
=
-
EBADF
;
filp
=
fget_light
(
fd
,
&
fput_neede
d
);
arg
=
fdget
(
f
d
);
if
(
filp
)
{
if
(
arg
.
file
)
{
ret
=
calls
->
spu_run
(
filp
,
unpc
,
ustatus
);
ret
=
calls
->
spu_run
(
arg
.
file
,
unpc
,
ustatus
);
f
put_light
(
filp
,
fput_needed
);
f
dput
(
arg
);
}
}
spufs_calls_put
(
calls
);
spufs_calls_put
(
calls
);
...
...
drivers/infiniband/core/ucma.c
View file @
2903ff01
...
@@ -1184,20 +1184,20 @@ static ssize_t ucma_migrate_id(struct ucma_file *new_file,
...
@@ -1184,20 +1184,20 @@ static ssize_t ucma_migrate_id(struct ucma_file *new_file,
struct
rdma_ucm_migrate_id
cmd
;
struct
rdma_ucm_migrate_id
cmd
;
struct
rdma_ucm_migrate_resp
resp
;
struct
rdma_ucm_migrate_resp
resp
;
struct
ucma_context
*
ctx
;
struct
ucma_context
*
ctx
;
struct
f
ile
*
filp
;
struct
f
d
f
;
struct
ucma_file
*
cur_file
;
struct
ucma_file
*
cur_file
;
int
ret
=
0
,
fput_needed
;
int
ret
=
0
;
if
(
copy_from_user
(
&
cmd
,
inbuf
,
sizeof
(
cmd
)))
if
(
copy_from_user
(
&
cmd
,
inbuf
,
sizeof
(
cmd
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* Get current fd to protect against it being closed */
/* Get current fd to protect against it being closed */
f
ilp
=
fget_light
(
cmd
.
fd
,
&
fput_neede
d
);
f
=
fdget
(
cmd
.
f
d
);
if
(
!
f
ilp
)
if
(
!
f
.
file
)
return
-
ENOENT
;
return
-
ENOENT
;
/* Validate current fd and prevent destruction of id. */
/* Validate current fd and prevent destruction of id. */
ctx
=
ucma_get_ctx
(
f
ilp
->
private_data
,
cmd
.
id
);
ctx
=
ucma_get_ctx
(
f
.
file
->
private_data
,
cmd
.
id
);
if
(
IS_ERR
(
ctx
))
{
if
(
IS_ERR
(
ctx
))
{
ret
=
PTR_ERR
(
ctx
);
ret
=
PTR_ERR
(
ctx
);
goto
file_put
;
goto
file_put
;
...
@@ -1231,7 +1231,7 @@ response:
...
@@ -1231,7 +1231,7 @@ response:
ucma_put_ctx
(
ctx
);
ucma_put_ctx
(
ctx
);
file_put:
file_put:
f
put_light
(
filp
,
fput_needed
);
f
dput
(
f
);
return
ret
;
return
ret
;
}
}
...
...
drivers/infiniband/core/uverbs_cmd.c
View file @
2903ff01
...
@@ -705,9 +705,9 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file,
...
@@ -705,9 +705,9 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file,
struct
ib_udata
udata
;
struct
ib_udata
udata
;
struct
ib_uxrcd_object
*
obj
;
struct
ib_uxrcd_object
*
obj
;
struct
ib_xrcd
*
xrcd
=
NULL
;
struct
ib_xrcd
*
xrcd
=
NULL
;
struct
f
ile
*
f
=
NULL
;
struct
f
d
f
=
{
NULL
,
0
}
;
struct
inode
*
inode
=
NULL
;
struct
inode
*
inode
=
NULL
;
int
ret
=
0
,
fput_needed
;
int
ret
=
0
;
int
new_xrcd
=
0
;
int
new_xrcd
=
0
;
if
(
out_len
<
sizeof
resp
)
if
(
out_len
<
sizeof
resp
)
...
@@ -724,13 +724,13 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file,
...
@@ -724,13 +724,13 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file,
if
(
cmd
.
fd
!=
-
1
)
{
if
(
cmd
.
fd
!=
-
1
)
{
/* search for file descriptor */
/* search for file descriptor */
f
=
f
get_light
(
cmd
.
fd
,
&
fput_neede
d
);
f
=
f
dget
(
cmd
.
f
d
);
if
(
!
f
)
{
if
(
!
f
.
file
)
{
ret
=
-
EBADF
;
ret
=
-
EBADF
;
goto
err_tree_mutex_unlock
;
goto
err_tree_mutex_unlock
;
}
}
inode
=
f
->
f_
dentry
->
d_inode
;
inode
=
f
.
file
->
f_path
.
dentry
->
d_inode
;
xrcd
=
find_xrcd
(
file
->
device
,
inode
);
xrcd
=
find_xrcd
(
file
->
device
,
inode
);
if
(
!
xrcd
&&
!
(
cmd
.
oflags
&
O_CREAT
))
{
if
(
!
xrcd
&&
!
(
cmd
.
oflags
&
O_CREAT
))
{
/* no file descriptor. Need CREATE flag */
/* no file descriptor. Need CREATE flag */
...
@@ -795,8 +795,8 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file,
...
@@ -795,8 +795,8 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file,
goto
err_copy
;
goto
err_copy
;
}
}
if
(
f
)
if
(
f
.
file
)
f
put_light
(
f
,
fput_needed
);
f
dput
(
f
);
mutex_lock
(
&
file
->
mutex
);
mutex_lock
(
&
file
->
mutex
);
list_add_tail
(
&
obj
->
uobject
.
list
,
&
file
->
ucontext
->
xrcd_list
);
list_add_tail
(
&
obj
->
uobject
.
list
,
&
file
->
ucontext
->
xrcd_list
);
...
@@ -825,8 +825,8 @@ err:
...
@@ -825,8 +825,8 @@ err:
put_uobj_write
(
&
obj
->
uobject
);
put_uobj_write
(
&
obj
->
uobject
);
err_tree_mutex_unlock:
err_tree_mutex_unlock:
if
(
f
)
if
(
f
.
file
)
f
put_light
(
f
,
fput_needed
);
f
dput
(
f
);
mutex_unlock
(
&
file
->
device
->
xrcd_tree_mutex
);
mutex_unlock
(
&
file
->
device
->
xrcd_tree_mutex
);
...
...
drivers/infiniband/core/uverbs_main.c
View file @
2903ff01
...
@@ -541,17 +541,15 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
...
@@ -541,17 +541,15 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
struct
ib_uverbs_event_file
*
ib_uverbs_lookup_comp_file
(
int
fd
)
struct
ib_uverbs_event_file
*
ib_uverbs_lookup_comp_file
(
int
fd
)
{
{
struct
ib_uverbs_event_file
*
ev_file
=
NULL
;
struct
ib_uverbs_event_file
*
ev_file
=
NULL
;
struct
file
*
filp
;
struct
fd
f
=
fdget
(
fd
);
int
fput_needed
;
filp
=
fget_light
(
fd
,
&
fput_needed
);
if
(
!
f
.
file
)
if
(
!
filp
)
return
NULL
;
return
NULL
;
if
(
f
ilp
->
f_op
!=
&
uverbs_event_fops
)
if
(
f
.
file
->
f_op
!=
&
uverbs_event_fops
)
goto
out
;
goto
out
;
ev_file
=
f
ilp
->
private_data
;
ev_file
=
f
.
file
->
private_data
;
if
(
ev_file
->
is_async
)
{
if
(
ev_file
->
is_async
)
{
ev_file
=
NULL
;
ev_file
=
NULL
;
goto
out
;
goto
out
;
...
@@ -560,7 +558,7 @@ struct ib_uverbs_event_file *ib_uverbs_lookup_comp_file(int fd)
...
@@ -560,7 +558,7 @@ struct ib_uverbs_event_file *ib_uverbs_lookup_comp_file(int fd)
kref_get
(
&
ev_file
->
ref
);
kref_get
(
&
ev_file
->
ref
);
out:
out:
f
put_light
(
filp
,
fput_needed
);
f
dput
(
f
);
return
ev_file
;
return
ev_file
;
}
}
...
...
drivers/vfio/vfio.c
View file @
2903ff01
...
@@ -1014,25 +1014,25 @@ static void vfio_group_try_dissolve_container(struct vfio_group *group)
...
@@ -1014,25 +1014,25 @@ static void vfio_group_try_dissolve_container(struct vfio_group *group)
static
int
vfio_group_set_container
(
struct
vfio_group
*
group
,
int
container_fd
)
static
int
vfio_group_set_container
(
struct
vfio_group
*
group
,
int
container_fd
)
{
{
struct
f
ile
*
filep
;
struct
f
d
f
;
struct
vfio_container
*
container
;
struct
vfio_container
*
container
;
struct
vfio_iommu_driver
*
driver
;
struct
vfio_iommu_driver
*
driver
;
int
ret
=
0
,
fput_needed
;
int
ret
=
0
;
if
(
atomic_read
(
&
group
->
container_users
))
if
(
atomic_read
(
&
group
->
container_users
))
return
-
EINVAL
;
return
-
EINVAL
;
f
ilep
=
fget_light
(
container_fd
,
&
fput_neede
d
);
f
=
fdget
(
container_f
d
);
if
(
!
f
ilep
)
if
(
!
f
.
file
)
return
-
EBADF
;
return
-
EBADF
;
/* Sanity check, is this really our fd? */
/* Sanity check, is this really our fd? */
if
(
f
ilep
->
f_op
!=
&
vfio_fops
)
{
if
(
f
.
file
->
f_op
!=
&
vfio_fops
)
{
f
put_light
(
filep
,
fput_needed
);
f
dput
(
f
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
container
=
f
ilep
->
private_data
;
container
=
f
.
file
->
private_data
;
WARN_ON
(
!
container
);
/* fget ensures we don't race vfio_release */
WARN_ON
(
!
container
);
/* fget ensures we don't race vfio_release */
mutex_lock
(
&
container
->
group_lock
);
mutex_lock
(
&
container
->
group_lock
);
...
@@ -1054,8 +1054,7 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd)
...
@@ -1054,8 +1054,7 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd)
unlock_out:
unlock_out:
mutex_unlock
(
&
container
->
group_lock
);
mutex_unlock
(
&
container
->
group_lock
);
fput_light
(
filep
,
fput_needed
);
fdput
(
f
);
return
ret
;
return
ret
;
}
}
...
...
drivers/video/msm/mdp.c
View file @
2903ff01
...
@@ -257,19 +257,17 @@ int get_img(struct mdp_img *img, struct fb_info *info,
...
@@ -257,19 +257,17 @@ int get_img(struct mdp_img *img, struct fb_info *info,
unsigned
long
*
start
,
unsigned
long
*
len
,
unsigned
long
*
start
,
unsigned
long
*
len
,
struct
file
**
filep
)
struct
file
**
filep
)
{
{
int
put_needed
,
ret
=
0
;
int
ret
=
0
;
struct
file
*
file
;
struct
fd
f
=
fdget
(
img
->
memory_id
);
if
(
f
.
file
==
NULL
)
file
=
fget_light
(
img
->
memory_id
,
&
put_needed
);
if
(
file
==
NULL
)
return
-
1
;
return
-
1
;
if
(
MAJOR
(
file
->
f_dentry
->
d_inode
->
i_rdev
)
==
FB_MAJOR
)
{
if
(
MAJOR
(
f
.
f
ile
->
f_dentry
->
d_inode
->
i_rdev
)
==
FB_MAJOR
)
{
*
start
=
info
->
fix
.
smem_start
;
*
start
=
info
->
fix
.
smem_start
;
*
len
=
info
->
fix
.
smem_len
;
*
len
=
info
->
fix
.
smem_len
;
}
else
}
else
ret
=
-
1
;
ret
=
-
1
;
f
put_light
(
file
,
put_needed
);
f
dput
(
f
);
return
ret
;
return
ret
;
}
}
...
...
fs/btrfs/ioctl.c
View file @
2903ff01
...
@@ -1397,7 +1397,6 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
...
@@ -1397,7 +1397,6 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
u64
*
transid
,
bool
readonly
,
u64
*
transid
,
bool
readonly
,
struct
btrfs_qgroup_inherit
**
inherit
)
struct
btrfs_qgroup_inherit
**
inherit
)
{
{
struct
file
*
src_file
;
int
namelen
;
int
namelen
;
int
ret
=
0
;
int
ret
=
0
;
...
@@ -1421,15 +1420,14 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
...
@@ -1421,15 +1420,14 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
ret
=
btrfs_mksubvol
(
&
file
->
f_path
,
name
,
namelen
,
ret
=
btrfs_mksubvol
(
&
file
->
f_path
,
name
,
namelen
,
NULL
,
transid
,
readonly
,
inherit
);
NULL
,
transid
,
readonly
,
inherit
);
}
else
{
}
else
{
struct
fd
src
=
fdget
(
fd
);
struct
inode
*
src_inode
;
struct
inode
*
src_inode
;
int
fput_needed
;
if
(
!
src
.
file
)
{
src_file
=
fget_light
(
fd
,
&
fput_needed
);
if
(
!
src_file
)
{
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
out_drop_write
;
goto
out_drop_write
;
}
}
src_inode
=
src
_
file
->
f_path
.
dentry
->
d_inode
;
src_inode
=
src
.
file
->
f_path
.
dentry
->
d_inode
;
if
(
src_inode
->
i_sb
!=
file
->
f_path
.
dentry
->
d_inode
->
i_sb
)
{
if
(
src_inode
->
i_sb
!=
file
->
f_path
.
dentry
->
d_inode
->
i_sb
)
{
printk
(
KERN_INFO
"btrfs: Snapshot src from "
printk
(
KERN_INFO
"btrfs: Snapshot src from "
"another FS
\n
"
);
"another FS
\n
"
);
...
@@ -1439,7 +1437,7 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
...
@@ -1439,7 +1437,7 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
BTRFS_I
(
src_inode
)
->
root
,
BTRFS_I
(
src_inode
)
->
root
,
transid
,
readonly
,
inherit
);
transid
,
readonly
,
inherit
);
}
}
f
put_light
(
src_file
,
fput_needed
);
f
dput
(
src
);
}
}
out_drop_write:
out_drop_write:
mnt_drop_write_file
(
file
);
mnt_drop_write_file
(
file
);
...
@@ -2341,7 +2339,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
...
@@ -2341,7 +2339,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
{
{
struct
inode
*
inode
=
fdentry
(
file
)
->
d_inode
;
struct
inode
*
inode
=
fdentry
(
file
)
->
d_inode
;
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
struct
f
ile
*
src_file
;
struct
f
d
src_file
;
struct
inode
*
src
;
struct
inode
*
src
;
struct
btrfs_trans_handle
*
trans
;
struct
btrfs_trans_handle
*
trans
;
struct
btrfs_path
*
path
;
struct
btrfs_path
*
path
;
...
@@ -2350,7 +2348,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
...
@@ -2350,7 +2348,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
struct
btrfs_key
key
;
struct
btrfs_key
key
;
u32
nritems
;
u32
nritems
;
int
slot
;
int
slot
;
int
ret
,
fput_needed
;
int
ret
;
u64
len
=
olen
;
u64
len
=
olen
;
u64
bs
=
root
->
fs_info
->
sb
->
s_blocksize
;
u64
bs
=
root
->
fs_info
->
sb
->
s_blocksize
;
u64
hint_byte
;
u64
hint_byte
;
...
@@ -2376,24 +2374,24 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
...
@@ -2376,24 +2374,24 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
src_file
=
f
get_light
(
srcfd
,
&
fput_neede
d
);
src_file
=
f
dget
(
srcf
d
);
if
(
!
src_file
)
{
if
(
!
src_file
.
file
)
{
ret
=
-
EBADF
;
ret
=
-
EBADF
;
goto
out_drop_write
;
goto
out_drop_write
;
}
}
ret
=
-
EXDEV
;
ret
=
-
EXDEV
;
if
(
src_file
->
f_path
.
mnt
!=
file
->
f_path
.
mnt
)
if
(
src_file
.
file
->
f_path
.
mnt
!=
file
->
f_path
.
mnt
)
goto
out_fput
;