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
b0217ce8
Commit
b0217ce8
authored
Jan 24, 2005
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename "locks_verify_area()" to "rw_verify_area()" and clean up the
arguments. And make it non-inlined.
parent
5781864c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
31 deletions
+20
-31
arch/mips/kernel/linux32.c
arch/mips/kernel/linux32.c
+2
-4
fs/compat.c
fs/compat.c
+1
-6
fs/locks.c
fs/locks.c
+1
-1
fs/read_write.c
fs/read_write.c
+15
-12
include/linux/fs.h
include/linux/fs.h
+1
-8
No files found.
arch/mips/kernel/linux32.c
View file @
b0217ce8
...
...
@@ -468,8 +468,7 @@ asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf,
if
(
!
(
file
->
f_mode
&
FMODE_READ
))
goto
out
;
pos
=
merge_64
(
a4
,
a5
);
ret
=
locks_verify_area
(
FLOCK_VERIFY_READ
,
file
->
f_dentry
->
d_inode
,
file
,
pos
,
count
);
ret
=
rw_verify_area
(
READ
,
file
,
&
pos
,
count
);
if
(
ret
)
goto
out
;
ret
=
-
EINVAL
;
...
...
@@ -504,8 +503,7 @@ asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf,
if
(
!
(
file
->
f_mode
&
FMODE_WRITE
))
goto
out
;
pos
=
merge_64
(
a4
,
a5
);
ret
=
locks_verify_area
(
FLOCK_VERIFY_WRITE
,
file
->
f_dentry
->
d_inode
,
file
,
pos
,
count
);
ret
=
rw_verify_area
(
WRITE
,
file
,
&
pos
,
count
);
if
(
ret
)
goto
out
;
ret
=
-
EINVAL
;
...
...
fs/compat.c
View file @
b0217ce8
...
...
@@ -1126,7 +1126,6 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
int
seg
;
io_fn_t
fn
;
iov_fn_t
fnv
;
struct
inode
*
inode
;
/*
* SuS says "The readv() function *may* fail if the iovcnt argument
...
...
@@ -1191,11 +1190,7 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
goto
out
;
}
inode
=
file
->
f_dentry
->
d_inode
;
/* VERIFY_WRITE actually means a read, as we write to user space */
ret
=
locks_verify_area
((
type
==
READ
?
FLOCK_VERIFY_READ
:
FLOCK_VERIFY_WRITE
),
inode
,
file
,
*
pos
,
tot_len
);
ret
=
rw_verify_area
(
type
,
file
,
pos
,
tot_len
);
if
(
ret
)
goto
out
;
...
...
fs/locks.c
View file @
b0217ce8
...
...
@@ -1011,7 +1011,7 @@ int locks_mandatory_locked(struct inode *inode)
* @count: length of area to check
*
* Searches the inode's list of locks to find any POSIX locks which conflict.
* This function is called from
locks
_verify_area() and
* This function is called from
rw
_verify_area() and
* locks_verify_truncate().
*/
int
locks_mandatory_area
(
int
read_write
,
struct
inode
*
inode
,
...
...
fs/read_write.c
View file @
b0217ce8
...
...
@@ -182,6 +182,16 @@ asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
}
#endif
int
rw_verify_area
(
int
read_write
,
struct
file
*
file
,
loff_t
*
ppos
,
size_t
count
)
{
struct
inode
*
inode
=
file
->
f_dentry
->
d_inode
;
if
(
inode
->
i_flock
&&
MANDATORY_LOCK
(
inode
))
return
locks_mandatory_area
(
read_write
==
READ
?
FLOCK_VERIFY_READ
:
FLOCK_VERIFY_WRITE
,
inode
,
file
,
*
ppos
,
count
);
return
0
;
}
ssize_t
do_sync_read
(
struct
file
*
filp
,
char
__user
*
buf
,
size_t
len
,
loff_t
*
ppos
)
{
struct
kiocb
kiocb
;
...
...
@@ -200,7 +210,6 @@ EXPORT_SYMBOL(do_sync_read);
ssize_t
vfs_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
pos
)
{
struct
inode
*
inode
=
file
->
f_dentry
->
d_inode
;
ssize_t
ret
;
if
(
!
(
file
->
f_mode
&
FMODE_READ
))
...
...
@@ -208,7 +217,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
if
(
!
file
->
f_op
||
(
!
file
->
f_op
->
read
&&
!
file
->
f_op
->
aio_read
))
return
-
EINVAL
;
ret
=
locks_verify_area
(
FLOCK_VERIFY_READ
,
inode
,
file
,
*
pos
,
count
);
ret
=
rw_verify_area
(
READ
,
file
,
pos
,
count
);
if
(
!
ret
)
{
ret
=
security_file_permission
(
file
,
MAY_READ
);
if
(
!
ret
)
{
...
...
@@ -247,7 +256,6 @@ EXPORT_SYMBOL(do_sync_write);
ssize_t
vfs_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
pos
)
{
struct
inode
*
inode
=
file
->
f_dentry
->
d_inode
;
ssize_t
ret
;
if
(
!
(
file
->
f_mode
&
FMODE_WRITE
))
...
...
@@ -255,7 +263,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
if
(
!
file
->
f_op
||
(
!
file
->
f_op
->
write
&&
!
file
->
f_op
->
aio_write
))
return
-
EINVAL
;
ret
=
locks_verify_area
(
FLOCK_VERIFY_WRITE
,
inode
,
file
,
*
pos
,
count
);
ret
=
rw_verify_area
(
WRITE
,
file
,
pos
,
count
);
if
(
!
ret
)
{
ret
=
security_file_permission
(
file
,
MAY_WRITE
);
if
(
!
ret
)
{
...
...
@@ -399,7 +407,6 @@ static ssize_t do_readv_writev(int type, struct file *file,
int
seg
;
io_fn_t
fn
;
iov_fn_t
fnv
;
struct
inode
*
inode
;
/*
* SuS says "The readv() function *may* fail if the iovcnt argument
...
...
@@ -452,11 +459,7 @@ static ssize_t do_readv_writev(int type, struct file *file,
goto
out
;
}
inode
=
file
->
f_dentry
->
d_inode
;
/* VERIFY_WRITE actually means a read, as we write to user space */
ret
=
locks_verify_area
((
type
==
READ
?
FLOCK_VERIFY_READ
:
FLOCK_VERIFY_WRITE
),
inode
,
file
,
*
pos
,
tot_len
);
ret
=
rw_verify_area
(
type
,
file
,
pos
,
tot_len
);
if
(
ret
)
goto
out
;
...
...
@@ -603,7 +606,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
else
if
(
!
(
in_file
->
f_mode
&
FMODE_PREAD
))
goto
fput_in
;
retval
=
locks_verify_area
(
FLOCK_VERIFY_READ
,
in_inode
,
in_file
,
*
ppos
,
count
);
retval
=
rw_verify_area
(
READ
,
in_file
,
ppos
,
count
);
if
(
retval
)
goto
fput_in
;
...
...
@@ -624,7 +627,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
if
(
!
out_file
->
f_op
||
!
out_file
->
f_op
->
sendpage
)
goto
fput_out
;
out_inode
=
out_file
->
f_dentry
->
d_inode
;
retval
=
locks_verify_area
(
FLOCK_VERIFY_WRITE
,
out_inode
,
out_file
,
out_file
->
f_pos
,
count
);
retval
=
rw_verify_area
(
WRITE
,
out_file
,
&
out_file
->
f_pos
,
count
);
if
(
retval
)
goto
fput_out
;
...
...
include/linux/fs.h
View file @
b0217ce8
...
...
@@ -1222,14 +1222,7 @@ static inline int locks_verify_locked(struct inode *inode)
return
0
;
}
static
inline
int
locks_verify_area
(
int
read_write
,
struct
inode
*
inode
,
struct
file
*
filp
,
loff_t
offset
,
size_t
count
)
{
if
(
inode
->
i_flock
&&
MANDATORY_LOCK
(
inode
))
return
locks_mandatory_area
(
read_write
,
inode
,
filp
,
offset
,
count
);
return
0
;
}
extern
int
rw_verify_area
(
int
,
struct
file
*
,
loff_t
*
,
size_t
);
static
inline
int
locks_verify_truncate
(
struct
inode
*
inode
,
struct
file
*
filp
,
...
...
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