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
632340cd
Commit
632340cd
authored
May 06, 2002
by
Dave Jones
Committed by
Linus Torvalds
May 06, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] capabilities for mtrr driver.
parent
6187ff39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
arch/i386/kernel/mtrr.c
arch/i386/kernel/mtrr.c
+9
-9
No files found.
arch/i386/kernel/mtrr.c
View file @
632340cd
...
...
@@ -1659,7 +1659,7 @@ static ssize_t mtrr_write (struct file *file, const char *buf, size_t len,
char
*
ptr
;
char
line
[
LINE_SIZE
];
if
(
!
suser
()
)
return
-
EPERM
;
if
(
!
capable
(
CAP_SYS_ADMIN
)
)
return
-
EPERM
;
/* Can't seek (pwrite) on this device */
if
(
ppos
!=
&
file
->
f_pos
)
return
-
ESPIPE
;
memset
(
line
,
0
,
LINE_SIZE
);
...
...
@@ -1727,28 +1727,28 @@ static int mtrr_ioctl (struct inode *inode, struct file *file,
default:
return
-
ENOIOCTLCMD
;
case
MTRRIOC_ADD_ENTRY
:
if
(
!
suser
(
)
)
return
-
EPERM
;
if
(
!
capable
(
CAP_SYS_ADMIN
)
)
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
)
)
return
-
EFAULT
;
err
=
mtrr_file_add
(
sentry
.
base
,
sentry
.
size
,
sentry
.
type
,
1
,
file
,
0
);
if
(
err
<
0
)
return
err
;
break
;
case
MTRRIOC_SET_ENTRY
:
if
(
!
suser
(
)
)
return
-
EPERM
;
if
(
!
capable
(
CAP_SYS_ADMIN
)
)
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
)
)
return
-
EFAULT
;
err
=
mtrr_add
(
sentry
.
base
,
sentry
.
size
,
sentry
.
type
,
0
);
if
(
err
<
0
)
return
err
;
break
;
case
MTRRIOC_DEL_ENTRY
:
if
(
!
suser
(
)
)
return
-
EPERM
;
if
(
!
capable
(
CAP_SYS_ADMIN
)
)
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
)
)
return
-
EFAULT
;
err
=
mtrr_file_del
(
sentry
.
base
,
sentry
.
size
,
file
,
0
);
if
(
err
<
0
)
return
err
;
break
;
case
MTRRIOC_KILL_ENTRY
:
if
(
!
suser
(
)
)
return
-
EPERM
;
if
(
!
capable
(
CAP_SYS_ADMIN
)
)
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
)
)
return
-
EFAULT
;
err
=
mtrr_del
(
-
1
,
sentry
.
base
,
sentry
.
size
);
...
...
@@ -1773,28 +1773,28 @@ static int mtrr_ioctl (struct inode *inode, struct file *file,
return
-
EFAULT
;
break
;
case
MTRRIOC_ADD_PAGE_ENTRY
:
if
(
!
suser
(
)
)
return
-
EPERM
;
if
(
!
capable
(
CAP_SYS_ADMIN
)
)
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
)
)
return
-
EFAULT
;
err
=
mtrr_file_add
(
sentry
.
base
,
sentry
.
size
,
sentry
.
type
,
1
,
file
,
1
);
if
(
err
<
0
)
return
err
;
break
;
case
MTRRIOC_SET_PAGE_ENTRY
:
if
(
!
suser
(
)
)
return
-
EPERM
;
if
(
!
capable
(
CAP_SYS_ADMIN
)
)
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
)
)
return
-
EFAULT
;
err
=
mtrr_add_page
(
sentry
.
base
,
sentry
.
size
,
sentry
.
type
,
0
);
if
(
err
<
0
)
return
err
;
break
;
case
MTRRIOC_DEL_PAGE_ENTRY
:
if
(
!
suser
(
)
)
return
-
EPERM
;
if
(
!
capable
(
CAP_SYS_ADMIN
)
)
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
)
)
return
-
EFAULT
;
err
=
mtrr_file_del
(
sentry
.
base
,
sentry
.
size
,
file
,
1
);
if
(
err
<
0
)
return
err
;
break
;
case
MTRRIOC_KILL_PAGE_ENTRY
:
if
(
!
suser
(
)
)
return
-
EPERM
;
if
(
!
capable
(
CAP_SYS_ADMIN
)
)
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
)
)
return
-
EFAULT
;
err
=
mtrr_del_page
(
-
1
,
sentry
.
base
,
sentry
.
size
);
...
...
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