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
a2e0578b
Commit
a2e0578b
authored
Aug 30, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch copy_module_from_fd() to fdget
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
e95c311e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
kernel/module.c
kernel/module.c
+6
-7
No files found.
kernel/module.c
View file @
a2e0578b
...
@@ -2540,21 +2540,20 @@ static int copy_module_from_user(const void __user *umod, unsigned long len,
...
@@ -2540,21 +2540,20 @@ static int copy_module_from_user(const void __user *umod, unsigned long len,
/* Sets info->hdr and info->len. */
/* Sets info->hdr and info->len. */
static
int
copy_module_from_fd
(
int
fd
,
struct
load_info
*
info
)
static
int
copy_module_from_fd
(
int
fd
,
struct
load_info
*
info
)
{
{
struct
f
ile
*
file
;
struct
f
d
f
=
fdget
(
fd
)
;
int
err
;
int
err
;
struct
kstat
stat
;
struct
kstat
stat
;
loff_t
pos
;
loff_t
pos
;
ssize_t
bytes
=
0
;
ssize_t
bytes
=
0
;
file
=
fget
(
fd
);
if
(
!
f
.
file
)
if
(
!
file
)
return
-
ENOEXEC
;
return
-
ENOEXEC
;
err
=
security_kernel_module_from_file
(
file
);
err
=
security_kernel_module_from_file
(
f
.
f
ile
);
if
(
err
)
if
(
err
)
goto
out
;
goto
out
;
err
=
vfs_getattr
(
&
file
->
f_path
,
&
stat
);
err
=
vfs_getattr
(
&
f
.
f
ile
->
f_path
,
&
stat
);
if
(
err
)
if
(
err
)
goto
out
;
goto
out
;
...
@@ -2577,7 +2576,7 @@ static int copy_module_from_fd(int fd, struct load_info *info)
...
@@ -2577,7 +2576,7 @@ static int copy_module_from_fd(int fd, struct load_info *info)
pos
=
0
;
pos
=
0
;
while
(
pos
<
stat
.
size
)
{
while
(
pos
<
stat
.
size
)
{
bytes
=
kernel_read
(
file
,
pos
,
(
char
*
)(
info
->
hdr
)
+
pos
,
bytes
=
kernel_read
(
f
.
f
ile
,
pos
,
(
char
*
)(
info
->
hdr
)
+
pos
,
stat
.
size
-
pos
);
stat
.
size
-
pos
);
if
(
bytes
<
0
)
{
if
(
bytes
<
0
)
{
vfree
(
info
->
hdr
);
vfree
(
info
->
hdr
);
...
@@ -2591,7 +2590,7 @@ static int copy_module_from_fd(int fd, struct load_info *info)
...
@@ -2591,7 +2590,7 @@ static int copy_module_from_fd(int fd, struct load_info *info)
info
->
len
=
pos
;
info
->
len
=
pos
;
out:
out:
f
put
(
file
);
f
dput
(
f
);
return
err
;
return
err
;
}
}
...
...
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