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
17d17e72
Commit
17d17e72
authored
Mar 21, 2015
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
process_vm_access: switch to {compat_,}import_iovec()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
b353a1f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
23 deletions
+12
-23
mm/process_vm_access.c
mm/process_vm_access.c
+12
-23
No files found.
mm/process_vm_access.c
View file @
17d17e72
...
@@ -257,22 +257,18 @@ static ssize_t process_vm_rw(pid_t pid,
...
@@ -257,22 +257,18 @@ static ssize_t process_vm_rw(pid_t pid,
struct
iovec
*
iov_r
=
iovstack_r
;
struct
iovec
*
iov_r
=
iovstack_r
;
struct
iov_iter
iter
;
struct
iov_iter
iter
;
ssize_t
rc
;
ssize_t
rc
;
int
dir
=
vm_write
?
WRITE
:
READ
;
if
(
flags
!=
0
)
if
(
flags
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
/* Check iovecs */
/* Check iovecs */
if
(
vm_write
)
rc
=
import_iovec
(
dir
,
lvec
,
liovcnt
,
UIO_FASTIOV
,
&
iov_l
,
&
iter
);
rc
=
rw_copy_check_uvector
(
WRITE
,
lvec
,
liovcnt
,
UIO_FASTIOV
,
if
(
rc
<
0
)
iovstack_l
,
&
iov_l
);
return
rc
;
else
if
(
!
iov_iter_count
(
&
iter
))
rc
=
rw_copy_check_uvector
(
READ
,
lvec
,
liovcnt
,
UIO_FASTIOV
,
iovstack_l
,
&
iov_l
);
if
(
rc
<=
0
)
goto
free_iovecs
;
goto
free_iovecs
;
iov_iter_init
(
&
iter
,
vm_write
?
WRITE
:
READ
,
iov_l
,
liovcnt
,
rc
);
rc
=
rw_copy_check_uvector
(
CHECK_IOVEC_ONLY
,
rvec
,
riovcnt
,
UIO_FASTIOV
,
rc
=
rw_copy_check_uvector
(
CHECK_IOVEC_ONLY
,
rvec
,
riovcnt
,
UIO_FASTIOV
,
iovstack_r
,
&
iov_r
);
iovstack_r
,
&
iov_r
);
if
(
rc
<=
0
)
if
(
rc
<=
0
)
...
@@ -283,8 +279,7 @@ static ssize_t process_vm_rw(pid_t pid,
...
@@ -283,8 +279,7 @@ static ssize_t process_vm_rw(pid_t pid,
free_iovecs:
free_iovecs:
if
(
iov_r
!=
iovstack_r
)
if
(
iov_r
!=
iovstack_r
)
kfree
(
iov_r
);
kfree
(
iov_r
);
if
(
iov_l
!=
iovstack_l
)
kfree
(
iov_l
);
kfree
(
iov_l
);
return
rc
;
return
rc
;
}
}
...
@@ -320,21 +315,16 @@ compat_process_vm_rw(compat_pid_t pid,
...
@@ -320,21 +315,16 @@ compat_process_vm_rw(compat_pid_t pid,
struct
iovec
*
iov_r
=
iovstack_r
;
struct
iovec
*
iov_r
=
iovstack_r
;
struct
iov_iter
iter
;
struct
iov_iter
iter
;
ssize_t
rc
=
-
EFAULT
;
ssize_t
rc
=
-
EFAULT
;
int
dir
=
vm_write
?
WRITE
:
READ
;
if
(
flags
!=
0
)
if
(
flags
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
vm_write
)
rc
=
compat_import_iovec
(
dir
,
lvec
,
liovcnt
,
UIO_FASTIOV
,
&
iov_l
,
&
iter
);
rc
=
compat_rw_copy_check_uvector
(
WRITE
,
lvec
,
liovcnt
,
if
(
rc
<
0
)
UIO_FASTIOV
,
iovstack_l
,
return
rc
;
&
iov_l
);
if
(
!
iov_iter_count
(
&
iter
))
else
rc
=
compat_rw_copy_check_uvector
(
READ
,
lvec
,
liovcnt
,
UIO_FASTIOV
,
iovstack_l
,
&
iov_l
);
if
(
rc
<=
0
)
goto
free_iovecs
;
goto
free_iovecs
;
iov_iter_init
(
&
iter
,
vm_write
?
WRITE
:
READ
,
iov_l
,
liovcnt
,
rc
);
rc
=
compat_rw_copy_check_uvector
(
CHECK_IOVEC_ONLY
,
rvec
,
riovcnt
,
rc
=
compat_rw_copy_check_uvector
(
CHECK_IOVEC_ONLY
,
rvec
,
riovcnt
,
UIO_FASTIOV
,
iovstack_r
,
UIO_FASTIOV
,
iovstack_r
,
&
iov_r
);
&
iov_r
);
...
@@ -346,8 +336,7 @@ compat_process_vm_rw(compat_pid_t pid,
...
@@ -346,8 +336,7 @@ compat_process_vm_rw(compat_pid_t pid,
free_iovecs:
free_iovecs:
if
(
iov_r
!=
iovstack_r
)
if
(
iov_r
!=
iovstack_r
)
kfree
(
iov_r
);
kfree
(
iov_r
);
if
(
iov_l
!=
iovstack_l
)
kfree
(
iov_l
);
kfree
(
iov_l
);
return
rc
;
return
rc
;
}
}
...
...
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