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
3d6ea290
Commit
3d6ea290
authored
Dec 10, 2016
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
splice/tee/vmsplice: validate flags
Long overdue... Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
f81dc7d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
fs/splice.c
fs/splice.c
+8
-0
include/linux/splice.h
include/linux/splice.h
+2
-0
No files found.
fs/splice.c
View file @
3d6ea290
...
@@ -1351,6 +1351,8 @@ SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov,
...
@@ -1351,6 +1351,8 @@ SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov,
struct
fd
f
;
struct
fd
f
;
long
error
;
long
error
;
if
(
unlikely
(
flags
&
~
SPLICE_F_ALL
))
return
-
EINVAL
;
if
(
unlikely
(
nr_segs
>
UIO_MAXIOV
))
if
(
unlikely
(
nr_segs
>
UIO_MAXIOV
))
return
-
EINVAL
;
return
-
EINVAL
;
else
if
(
unlikely
(
!
nr_segs
))
else
if
(
unlikely
(
!
nr_segs
))
...
@@ -1401,6 +1403,9 @@ SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in,
...
@@ -1401,6 +1403,9 @@ SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in,
if
(
unlikely
(
!
len
))
if
(
unlikely
(
!
len
))
return
0
;
return
0
;
if
(
unlikely
(
flags
&
~
SPLICE_F_ALL
))
return
-
EINVAL
;
error
=
-
EBADF
;
error
=
-
EBADF
;
in
=
fdget
(
fd_in
);
in
=
fdget
(
fd_in
);
if
(
in
.
file
)
{
if
(
in
.
file
)
{
...
@@ -1729,6 +1734,9 @@ SYSCALL_DEFINE4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags)
...
@@ -1729,6 +1734,9 @@ SYSCALL_DEFINE4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags)
struct
fd
in
;
struct
fd
in
;
int
error
;
int
error
;
if
(
unlikely
(
flags
&
~
SPLICE_F_ALL
))
return
-
EINVAL
;
if
(
unlikely
(
!
len
))
if
(
unlikely
(
!
len
))
return
0
;
return
0
;
...
...
include/linux/splice.h
View file @
3d6ea290
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#define SPLICE_F_MORE (0x04)
/* expect more data */
#define SPLICE_F_MORE (0x04)
/* expect more data */
#define SPLICE_F_GIFT (0x08)
/* pages passed in are a gift */
#define SPLICE_F_GIFT (0x08)
/* pages passed in are a gift */
#define SPLICE_F_ALL (SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT)
/*
/*
* Passed to the actors
* Passed to the actors
*/
*/
...
...
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